bufref: add Curl_bufref_dup that returns a strdup()ed version

Cleans up a common pattern somewhat. Implemented as a macro.

Closes #19834
This commit is contained in:
Daniel Stenberg 2025-12-04 16:39:22 +01:00
parent d7928029fc
commit d517efe5bd
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 20 additions and 8 deletions

View file

@ -2011,7 +2011,7 @@ static CURLMcode state_performing(struct Curl_easy *data,
data->state.errorbuf = FALSE;
if(!newurl)
/* typically for HTTP_1_1_REQUIRED error on first flight */
newurl = curlx_strdup(Curl_bufref_ptr(&data->state.url));
newurl = Curl_bufref_dup(&data->state.url);
if(!newurl) {
result = CURLE_OUT_OF_MEMORY;
}