]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: add defensive check on data->multi->num_alive
authorxquery <jim@webcomposite.com>
Mon, 8 Jun 2020 11:25:56 +0000 (13:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 8 Jun 2020 14:14:07 +0000 (16:14 +0200)
Closes #5540

lib/multi.c

index a614929eca52ad691de312fe23e9035367473994..d20b33dbce82854a83e1ac55ec5e9ca8d7d04d85 100644 (file)
@@ -168,9 +168,11 @@ static void mstate(struct Curl_easy *data, CURLMstate state
   }
 #endif
 
-  if(state == CURLM_STATE_COMPLETED)
+  if(state == CURLM_STATE_COMPLETED) {
     /* changing to COMPLETED means there's one less easy handle 'alive' */
+    DEBUGASSERT(data->multi->num_alive > 0);
     data->multi->num_alive--;
+  }
 
   /* if this state has an init-function, run it */
   if(finit[state])