summaryrefslogtreecommitdiff
path: root/www/curl/patches/patch-lib_multi.c
blob: b46e3f44e4a6acca0c77ae2cdaa85fa6f240c913 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$NetBSD: patch-lib_multi.c,v 1.1 2013/03/10 13:21:05 obache Exp $

Fix NULL pointer reference when closing an unused multi handle.
(upstream commit da3fc1ee91de656a30f3a12de394bcba55119872)

--- lib/multi.c.orig	2013-02-05 22:01:40.000000000 +0000
+++ lib/multi.c
@@ -1773,10 +1773,12 @@ CURLMcode curl_multi_cleanup(CURLM *mult
     /* Close all the connections in the connection cache */
     close_all_connections(multi);
 
-    multi->closure_handle->dns.hostcache = multi->hostcache;
-    Curl_hostcache_clean(multi->closure_handle);
+    if(multi->closure_handle) {
+      multi->closure_handle->dns.hostcache = multi->hostcache;
+      Curl_hostcache_clean(multi->closure_handle);
 
-    Curl_close(multi->closure_handle);
+      Curl_close(multi->closure_handle);
+    }
     multi->closure_handle = NULL;
 
     Curl_hash_destroy(multi->sockhash);