From ac9a179fe980f1a78438a791671e22671ebb6451 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 14 Jun 2018 16:28:59 +0200 Subject: 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 --- lib/asyn-thread.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/asyn-thread.c') 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); -- cgit v1.2.3