diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-01-10 10:07:07 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-01-10 10:07:07 +0000 |
commit | 21bb852750d39a51d20e29652d29b0be5fdbef38 (patch) | |
tree | 5b38e412a90180dabacaaec4d17428171001de77 /lib/url.c | |
parent | 83bab78bdaeecc7fd5cae3c035d5239b0d38468f (diff) |
Pavel Orehov reported memory problems with the multi interface in bug report
#1098843. In short, a shared DNS cache was setup for a multi handle and when
the shared cache was deleted before the individual easy handles, the latter
cleanups caused read/writes to already freed memory.
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -118,6 +118,7 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by #include "http_digest.h" #include "http_negotiate.h" #include "select.h" +#include "multi.h" /* And now for the protocols */ #include "ftp.h" @@ -196,6 +197,10 @@ void Curl_safefree(void *ptr) CURLcode Curl_close(struct SessionHandle *data) { + if(data->multi) { + /* this handle is still part of a multi handle, take care of this first */ + Curl_multi_rmeasy(data->multi, data); + } /* Loop through all open connections and kill them one by one */ while(-1 != ConnectionKillOne(data)) ; /* empty loop */ @@ -1422,7 +1427,10 @@ CURLcode Curl_disconnect(struct connectdata *conn) data = conn->data; - if(conn->dns_entry) + if(conn->dns_entry && data->hostcache) + /* if the DNS entry is still around, and the host cache is not blanked + (which it is for example when a shared one is killed by + curl_multi_cleanup() and similar stuff) */ Curl_resolv_unlock(data, conn->dns_entry); /* done with this */ #if defined(CURLDEBUG) && defined(AGGRESIVE_TEST) |