summaryrefslogtreecommitdiff
path: root/core/curl/0001-curl_multi_remove_handle-allow-multiple-removes.patch
blob: 73b23ea12d56ed0e801ee5719e6c1056fef87a06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 84f3b3dd448399f9548468676e1bd1475dba8de5 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Thu, 29 Aug 2013 22:08:01 +0200
Subject: [PATCH] curl_multi_remove_handle: allow multiple removes

When removing an already removed handle, avoid that to ruin the
internals and just return OK instead.
---
 lib/multi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/multi.c b/lib/multi.c
index fb495e0..e723a3e 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -483,6 +483,10 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
   if(!GOOD_EASY_HANDLE(curl_handle))
     return CURLM_BAD_EASY_HANDLE;
 
+  /* Prevent users from trying to remove same easy handle more than once */
+  if(!data->multi)
+    return CURLM_OK; /* it is already removed so let's say it is fine! */
+
   if(easy) {
     bool premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE;
     bool easy_owns_conn = (data->easy_conn &&
-- 
1.8.4