From: Yang Tse Date: Thu, 27 Oct 2011 15:08:02 +0000 (+0200) Subject: multi.c: OOM handling fix X-Git-Tag: curl-7_23_0~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ddeab4824534227611fe257485a8c22c896f07d7;p=thirdparty%2Fcurl.git multi.c: OOM handling fix Fix curl_multi_cleanup() segfault when using weird cleanup sequence. --- diff --git a/lib/multi.c b/lib/multi.c index 5026f8d2df..63aac69fa3 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1775,10 +1775,6 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) if(GOOD_MULTI_HANDLE(multi)) { multi->type = 0; /* not good anymore */ - Curl_hash_destroy(multi->hostcache); - Curl_hash_destroy(multi->sockhash); - multi->hostcache = NULL; - multi->sockhash = NULL; /* go over all connections that have close actions */ for(i=0; i< multi->connc->num; i++) { @@ -1802,6 +1798,12 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) cl= n; } + Curl_hash_destroy(multi->hostcache); + multi->hostcache = NULL; + + Curl_hash_destroy(multi->sockhash); + multi->sockhash = NULL; + Curl_rm_connc(multi->connc); multi->connc = NULL;