aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2012-11-18 16:17:37 +0100
committerDaniel Stenberg <daniel@haxx.se>2012-11-18 16:39:31 +0100
commit409f2a041f752ef635354e1dc7b2759fcd7088d6 (patch)
treeba6516576b5a6692398374cedddf16000fa1100d /lib/multi.c
parentdd75cba3ef1a9e6ddaae9d62080713101403af1c (diff)
fixed memory leak: CURLOPT_RESOLVE with multi interface
DNS cache entries populated with CURLOPT_RESOLVE were not properly freed again when done using the multi interface. Test case 1502 added to verify. Bug: http://curl.haxx.se/bug/view.cgi?id=3575448 Reported by: Alex Gruz
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 938846769..b4e01bd93 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1789,12 +1789,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
} WHILE_FALSE; /* just to break out from! */
if(CURLM_STATE_COMPLETED == easy->state) {
- if(data->dns.hostcachetype == HCACHE_MULTI) {
- /* clear out the usage of the shared DNS cache */
- data->dns.hostcache = NULL;
- data->dns.hostcachetype = HCACHE_NONE;
- }
-
/* now fill in the Curl_message with this info */
msg = &easy->msg;
@@ -1911,9 +1905,6 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
cl= n;
}
- Curl_hash_destroy(multi->hostcache);
- multi->hostcache = NULL;
-
Curl_hash_destroy(multi->sockhash);
multi->sockhash = NULL;
@@ -1930,6 +1921,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
nexteasy=easy->next;
if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) {
/* clear out the usage of the shared DNS cache */
+ Curl_hostcache_clean(easy->easy_handle);
easy->easy_handle->dns.hostcache = NULL;
easy->easy_handle->dns.hostcachetype = HCACHE_NONE;
}
@@ -1943,6 +1935,9 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
easy = nexteasy;
}
+ Curl_hash_destroy(multi->hostcache);
+ multi->hostcache = NULL;
+
free(multi);
return CURLM_OK;