From: x2018 Date: Mon, 3 Nov 2025 16:47:36 +0000 (+0800) Subject: http: check the return value of strdup X-Git-Tag: curl-8_17_0~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=231f0a2eecedd3cdb04463fb95754ebdfb0c8cb1;p=thirdparty%2Fcurl.git http: check the return value of strdup Closes #19343 --- diff --git a/lib/http.c b/lib/http.c index 16d619951f..529c3c907d 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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");