mirror of
https://github.com/curl/curl.git
synced 2026-08-24 14:33:33 +03:00
resolve: don't leak pre-populated dns entries
CURLOPT_RESOLVE populates the DNS cache with entries that are marked as eternally in use. Those entries need to be taken care of when the cache is killed off. Bug: http://curl.haxx.se/bug/view.cgi?id=3463121 Reported by: "tw84452852"
This commit is contained in:
parent
3e4181f88e
commit
2caa454dc1
3 changed files with 29 additions and 12 deletions
15
lib/url.c
15
lib/url.c
|
|
@ -467,11 +467,8 @@ CURLcode Curl_close(struct SessionHandle *data)
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
if(data->dns.hostcachetype == HCACHE_PRIVATE) {
|
||||
Curl_hash_destroy(data->dns.hostcache);
|
||||
data->dns.hostcachetype = HCACHE_NONE;
|
||||
data->dns.hostcache = NULL;
|
||||
}
|
||||
if(data->dns.hostcachetype == HCACHE_PRIVATE)
|
||||
Curl_hostcache_destroy(data);
|
||||
|
||||
if(data->state.rangestringalloc)
|
||||
free(data->state.range);
|
||||
|
|
@ -2131,7 +2128,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
|||
if(data->share->hostcache) {
|
||||
/* use shared host cache, first free the private one if any */
|
||||
if(data->dns.hostcachetype == HCACHE_PRIVATE)
|
||||
Curl_hash_destroy(data->dns.hostcache);
|
||||
Curl_hostcache_destroy(data);
|
||||
|
||||
data->dns.hostcache = data->share->hostcache;
|
||||
data->dns.hostcachetype = HCACHE_SHARED;
|
||||
|
|
@ -2626,12 +2623,6 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
|
|||
conn->dns_entry = NULL;
|
||||
}
|
||||
|
||||
#if defined(DEBUGBUILD) && defined(AGGRESIVE_TEST)
|
||||
/* scan for DNS cache entries still marked as in use */
|
||||
Curl_hash_apply(data->hostcache,
|
||||
NULL, Curl_scan_cache_used);
|
||||
#endif
|
||||
|
||||
Curl_hostcache_prune(data); /* kill old DNS cache entries */
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue