]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: check the return value of strdup()
authorx2018 <xkernel.wang@foxmail.com>
Mon, 3 Nov 2025 17:12:42 +0000 (01:12 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 3 Nov 2025 19:19:36 +0000 (20:19 +0100)
Closes #19344

lib/multi.c

index ca7c1bdd95425d30dce8038d8f3d73b9018e7ec0..c27e8bdad8b329ebbea80495e443ee0c2118d9d1 100644 (file)
@@ -1990,11 +1990,16 @@ static CURLMcode state_performing(struct Curl_easy *data,
       if(!newurl)
         /* typically for HTTP_1_1_REQUIRED error on first flight */
         newurl = strdup(data->state.url);
-      /* if we are to retry, set the result to OK and consider the request
-         as done */
-      retry = TRUE;
-      result = CURLE_OK;
-      data->req.done = TRUE;
+      if(!newurl) {
+        result = CURLE_OUT_OF_MEMORY;
+      }
+      else {
+        /* if we are to retry, set the result to OK and consider the request
+          as done */
+        retry = TRUE;
+        result = CURLE_OK;
+        data->req.done = TRUE;
+      }
     }
     else
       result = ret;