]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
remove_handle: clear expire timers after multi_done()
authorDaniel Stenberg <daniel@haxx.se>
Sun, 10 Nov 2019 15:23:53 +0000 (16:23 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 11 Nov 2019 13:49:17 +0000 (14:49 +0100)
Since 59041f0, a new timer might be set in multi_done() so the clearing
of the timers need to happen afterwards!

Reported-by: Max Kellermann
Fixes #4575
Closes #4583

lib/multi.c

index 6dfe8842e7162b6176c4ab19bd9158e05e7e989d..7e8e38dc9f9d129980b41e6a967b96185f679b36 100755 (executable)
@@ -695,11 +695,6 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
     easy_owns_conn = TRUE;
   }
 
-  /* The timer must be shut down before data->multi is set to NULL,
-     else the timenode will remain in the splay tree after
-     curl_easy_cleanup is called. */
-  Curl_expire_clear(data);
-
   if(data->conn) {
 
     /* we must call multi_done() here (if we still own the connection) so that
@@ -715,6 +710,11 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
     }
   }
 
+  /* The timer must be shut down before data->multi is set to NULL, else the
+     timenode will remain in the splay tree after curl_easy_cleanup is
+     called. Do it after multi_done() in case that sets another time! */
+  Curl_expire_clear(data);
+
   if(data->connect_queue.ptr)
     /* the handle was in the pending list waiting for an available connection,
        so go ahead and remove it */