From: x2018 Date: Mon, 3 Nov 2025 17:12:42 +0000 (+0800) Subject: multi: check the return value of strdup() X-Git-Tag: curl-8_17_0~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6adefe8ad08606c94d2bcb27eceface8aa556519;p=thirdparty%2Fcurl.git multi: check the return value of strdup() Closes #19344 --- diff --git a/lib/multi.c b/lib/multi.c index ca7c1bdd95..c27e8bdad8 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -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;