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

lib/http.c

index 16d619951fb02168c0e17caadf274005cfcd3963..529c3c907d6035b3129ccb406dd6c090b0f53766 100644 (file)
@@ -4039,9 +4039,13 @@ static CURLcode http_on_response(struct Curl_easy *data,
                 goto out;
             }
             data->state.disableexpect = TRUE;
+            Curl_req_abort_sending(data);
             DEBUGASSERT(!data->req.newurl);
             data->req.newurl = strdup(data->state.url);
-            Curl_req_abort_sending(data);
+            if(!data->req.newurl) {
+              result = CURLE_OUT_OF_MEMORY;
+              goto out;
+            }
           }
           else if(data->set.http_keep_sending_on_error) {
             infof(data, "HTTP error before end of send, keep sending");