summaryrefslogtreecommitdiff
path: root/lib/asyn-thread.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2017-08-28 23:43:36 +0200
committerDan Fandrich <dan@coneharvesters.com>2017-08-28 23:55:55 +0200
commitd5d736726ca8b4da08809ced2b77baafd7031975 (patch)
tree9f93fc4c3e267312ee5a6c1127c5977c6273dae8 /lib/asyn-thread.c
parent11a8778e0b720a1683dabdfe7d2b21f6dcb138fd (diff)
downloadcurl-d5d736726ca8b4da08809ced2b77baafd7031975.tar.gz
asyn-thread: Improved cleanup after OOM situations
Diffstat (limited to 'lib/asyn-thread.c')
-rw-r--r--lib/asyn-thread.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index fa47f554a..c9f443167 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -384,7 +384,7 @@ static bool init_resolve_thread(struct connectdata *conn,
conn->async.os_specific = (void *)td;
if(!td)
- goto err_exit;
+ goto errno_exit;
conn->async.port = port;
conn->async.done = FALSE;
@@ -392,8 +392,11 @@ static bool init_resolve_thread(struct connectdata *conn,
conn->async.dns = NULL;
td->thread_hnd = curl_thread_t_null;
- if(!init_thread_sync_data(td, hostname, port, hints))
- goto err_exit;
+ if(!init_thread_sync_data(td, hostname, port, hints)) {
+ conn->async.os_specific = NULL;
+ free(td);
+ goto errno_exit;
+ }
free(conn->async.hostname);
conn->async.hostname = strdup(hostname);
@@ -416,6 +419,7 @@ static bool init_resolve_thread(struct connectdata *conn,
err_exit:
destroy_async_data(&conn->async);
+ errno_exit:
errno = err;
return FALSE;
}