From 0fb0a7062e558fecdcf8c0c21503a28081370d9f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 4 Nov 2017 21:37:44 +0100 Subject: fixup connection cache free in curl_easy_cleanup --- lib/conncache.c | 10 ++-------- lib/conncache.h | 2 -- lib/share.c | 8 +++----- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/conncache.c b/lib/conncache.c index 68ec1e3bf..f8ef2e88b 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -117,11 +117,6 @@ static void free_bundle_hash_entry(void *freethis) bundle_destroy(b); } -bool Curl_conncache_inited(struct conncache *connc) -{ - return connc->inited; -} - int Curl_conncache_init(struct conncache *connc, int size) { int rc; @@ -137,10 +132,9 @@ int Curl_conncache_init(struct conncache *connc, int size) Curl_close(connc->closure_handle); connc->closure_handle = NULL; } - else { + else connc->closure_handle->state.conn_cache = connc; - connc->inited = TRUE; - } + return rc; } diff --git a/lib/conncache.h b/lib/conncache.h index 05857c436..0d97a6cef 100644 --- a/lib/conncache.h +++ b/lib/conncache.h @@ -24,7 +24,6 @@ ***************************************************************************/ struct conncache { - bool inited; /* FALSE until inited */ struct curl_hash hash; size_t num_connections; long next_connection_id; @@ -46,7 +45,6 @@ struct connectbundle { /* returns 1 on error, 0 is fine */ int Curl_conncache_init(struct conncache *, int size); -bool Curl_conncache_inited(struct conncache *); void Curl_conncache_destroy(struct conncache *connc); /* return the correct bundle, to a host or a proxy */ diff --git a/lib/share.c b/lib/share.c index c9ff8b4a1..c1ce1aab1 100644 --- a/lib/share.c +++ b/lib/share.c @@ -188,11 +188,9 @@ curl_share_cleanup(struct Curl_share *share) return CURLSHE_IN_USE; } - if(Curl_conncache_inited(&share->conn_cache)) { - Curl_conncache_close_all_connections(&share->conn_cache); - Curl_conncache_destroy(&share->conn_cache); - Curl_hash_destroy(&share->hostcache); - } + Curl_conncache_close_all_connections(&share->conn_cache); + Curl_conncache_destroy(&share->conn_cache); + Curl_hash_destroy(&share->hostcache); #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) Curl_cookie_cleanup(share->cookies); -- cgit v1.2.1