aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/multi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/multi.c b/lib/multi.c
index c0f9a7918..c3463b0ce 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -315,7 +315,12 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
easy->easy_handle = easy_handle;
multistate(easy, CURLM_STATE_INIT);
- /* for multi interface connections, we share DNS cache automaticly */
+ /* for multi interface connections, we share DNS cache automaticly.
+ First kill the existing one if there is any. */
+ if (easy->easy_handle->hostcache &&
+ easy->easy_handle->hostcache != multi->hostcache)
+ Curl_hash_destroy(easy->easy_handle->hostcache);
+
easy->easy_handle->hostcache = multi->hostcache;
/* We add this new entry first in the list. We make our 'next' point to the