aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-10-27 17:08:02 +0200
committerYang Tse <yangsita@gmail.com>2011-10-27 17:08:02 +0200
commitddeab4824534227611fe257485a8c22c896f07d7 (patch)
treea7b94743c1c39a68477475ae6f04d7ebe2e3662a
parentb0d42da26bd66baf326781149bdbdd7336d51269 (diff)
multi.c: OOM handling fix
Fix curl_multi_cleanup() segfault when using weird cleanup sequence.
-rw-r--r--lib/multi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 5026f8d2d..63aac69fa 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;