From dcd7e37c3a0ce108635b89cacc1e3425e57bd3bc Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 28 Oct 2019 09:28:05 +0100 Subject: url: make Curl_close() NULLify the pointer too This is the common pattern used in the code and by a unified approach we avoid mistakes. Closes #4534 --- lib/conncache.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/conncache.c') diff --git a/lib/conncache.c b/lib/conncache.c index 2f4dd4bc3..57d6061fd 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -143,10 +143,8 @@ int Curl_conncache_init(struct conncache *connc, int size) rc = Curl_hash_init(&connc->hash, size, Curl_hash_str, Curl_str_key_compare, free_bundle_hash_entry); - if(rc) { - Curl_close(connc->closure_handle); - connc->closure_handle = NULL; - } + if(rc) + Curl_close(&connc->closure_handle); else connc->closure_handle->state.conn_cache = connc; @@ -595,7 +593,7 @@ void Curl_conncache_close_all_connections(struct conncache *connc) Curl_hostcache_clean(connc->closure_handle, connc->closure_handle->dns.hostcache); - Curl_close(connc->closure_handle); + Curl_close(&connc->closure_handle); sigpipe_restore(&pipe_st); } } -- cgit v1.2.3