diff options
author | Daniel Stenberg <daniel@haxx.se> | 2012-11-18 16:17:37 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-11-18 16:39:31 +0100 |
commit | 409f2a041f752ef635354e1dc7b2759fcd7088d6 (patch) | |
tree | ba6516576b5a6692398374cedddf16000fa1100d /lib/hostip.c | |
parent | dd75cba3ef1a9e6ddaae9d62080713101403af1c (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/hostip.c')
-rw-r--r-- | lib/hostip.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/hostip.c b/lib/hostip.c index 503ba483f..ef14ce863 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -740,14 +740,18 @@ static int hostcache_inuse(void *data, void *hc) return 1; /* free all entries */ } -void Curl_hostcache_destroy(struct SessionHandle *data) +void Curl_hostcache_clean(struct SessionHandle *data) { /* Entries added to the hostcache with the CURLOPT_RESOLVE function are * still present in the cache with the inuse counter set to 1. Detect them * and cleanup! */ Curl_hash_clean_with_criterium(data->dns.hostcache, data, hostcache_inuse); +} +void Curl_hostcache_destroy(struct SessionHandle *data) +{ + Curl_hostcache_clean(data); Curl_hash_destroy(data->dns.hostcache); data->dns.hostcachetype = HCACHE_NONE; data->dns.hostcache = NULL; |