1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

asyn-thread: Improved cleanup after OOM situations

This commit is contained in:
Dan Fandrich 2017-08-28 23:43:36 +02:00
parent 11a8778e0b
commit d5d736726c

View File

@ -384,7 +384,7 @@ static bool init_resolve_thread(struct connectdata *conn,
conn->async.os_specific = (void *)td; conn->async.os_specific = (void *)td;
if(!td) if(!td)
goto err_exit; goto errno_exit;
conn->async.port = port; conn->async.port = port;
conn->async.done = FALSE; conn->async.done = FALSE;
@ -392,8 +392,11 @@ static bool init_resolve_thread(struct connectdata *conn,
conn->async.dns = NULL; conn->async.dns = NULL;
td->thread_hnd = curl_thread_t_null; td->thread_hnd = curl_thread_t_null;
if(!init_thread_sync_data(td, hostname, port, hints)) if(!init_thread_sync_data(td, hostname, port, hints)) {
goto err_exit; conn->async.os_specific = NULL;
free(td);
goto errno_exit;
}
free(conn->async.hostname); free(conn->async.hostname);
conn->async.hostname = strdup(hostname); conn->async.hostname = strdup(hostname);
@ -416,6 +419,7 @@ static bool init_resolve_thread(struct connectdata *conn,
err_exit: err_exit:
destroy_async_data(&conn->async); destroy_async_data(&conn->async);
errno_exit:
errno = err; errno = err;
return FALSE; return FALSE;
} }