asyn-thread: fix socket leak on OOM

Closes #9310
This commit is contained in:
Daniel Stenberg 2022-08-14 23:52:12 +02:00
parent 472369f589
commit f236595ecc
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -264,7 +264,12 @@ int init_thread_sync_data(struct thread_data *td,
return 1;
err_exit:
/* Memory allocation failed */
#ifndef CURL_DISABLE_SOCKETPAIR
if(tsd->sock_pair[0] != CURL_SOCKET_BAD) {
sclose(tsd->sock_pair[0]);
tsd->sock_pair[0] = CURL_SOCKET_BAD;
}
#endif
destroy_thread_sync_data(tsd);
return 0;
}