diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-06-14 16:28:59 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-06-16 12:01:27 +0200 |
commit | ac9a179fe980f1a78438a791671e22671ebb6451 (patch) | |
tree | 4ac3b096f2d1ce523621175da41c0d41cfaf2525 /lib/asyn-thread.c | |
parent | 676f4b742df634afc862a8e2ee9bd717d7efd03d (diff) | |
download | curl-ac9a179fe980f1a78438a791671e22671ebb6451.tar.gz |
multi: fix memory leak when stopped during name resolve
When the application just started the transfer and then stops it while
the name resolve in the background thread hasn't completed, we need to
wait for the resolve to complete and then cleanup data accordingly.
Enabled test 1553 again and added test 1590 to also check when the host
name resolves successfully.
Detected by OSS-fuzz.
Closes #1968
Diffstat (limited to 'lib/asyn-thread.c')
-rw-r--r-- | lib/asyn-thread.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index b11fab246..894ca459b 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -481,8 +481,10 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, DEBUGASSERT(conn && td); /* wait for the thread to resolve the name */ - if(Curl_thread_join(&td->thread_hnd)) - result = getaddrinfo_complete(conn); + if(Curl_thread_join(&td->thread_hnd)) { + if(entry) + result = getaddrinfo_complete(conn); + } else DEBUGASSERT(0); |