summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-11-04 21:37:44 +0100
committerDaniel Stenberg <daniel@haxx.se>2017-11-04 21:37:44 +0100
commit0fb0a7062e558fecdcf8c0c21503a28081370d9f (patch)
treecb8f110f5f7f8ac7bb935887e7200ed3e154893c
parent10150907ade0717be002edfc1c48b2cd13bd68b7 (diff)
downloadcurl-bagder/share-connection-cache.tar.gz
fixup connection cache free in curl_easy_cleanupbagder/share-connection-cache
-rw-r--r--lib/conncache.c10
-rw-r--r--lib/conncache.h2
-rw-r--r--lib/share.c8
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);