aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-05-09 11:33:00 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-05-09 11:33:00 +0000
commit73daf8ce334dc3d3dc8215cd898cfbb9fe3267de (patch)
treee6b8e0137600d2ef7f7cc8699d9cee091bb721aa
parent094ceeba14b407f8eafb67d26659649f0dda4b09 (diff)
Robson Braga Araujo fixed a memory leak when you added an easy handle to a
multi stack and that easy handle had already been used to do one or more easy interface transfers, as then the code threw away the previously used DNS cache without properly freeing it.
-rw-r--r--CHANGES6
-rw-r--r--RELEASE-NOTES1
-rw-r--r--lib/multi.c7
3 files changed, 13 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 03fd1ba92..b6845fa16 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,12 @@
Changelog
+Daniel (9 May 2006)
+- Robson Braga Araujo fixed a memory leak when you added an easy handle to a
+ multi stack and that easy handle had already been used to do one or more
+ easy interface transfers, as then the code threw away the previously used
+ DNS cache without properly freeing it.
+
Daniel (8 May 2006)
- Fixed known bug #28. The TFTP code no longer assumes a packed struct and
thus works reliably on more platforms.
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 208e5b1be..e130302eb 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -20,6 +20,7 @@ This release includes the following changes:
This release includes the following bugfixes:
+ o possible memory leak when adding easy handles to multi stack
o TFTP works in a more portable fashion (== on more platforms)
o WSAGetLastError() is now used (better) on Windows
o GnuTLS non-block case that could cause data trashing
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