tool_getparam: use correct free function for libcurl memory

Memory returned from curl_easy_escape() should be fred with curl_free()
to avoid surprises.

Follow-up to f37840a46e

Spotted by Codex Security
Closes #21075
This commit is contained in:
Daniel Stenberg 2026-03-23 15:04:21 +01:00
parent 14712fa513
commit 29dfc0238c
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -727,7 +727,11 @@ static ParameterError data_urlencode(const char *nextarg,
size = curlx_dyn_len(&dyn);
}
else {
n = enc;
/* make sure we return "our memory" */
n = curlx_strdup(enc);
curl_free(enc);
if(!n)
return PARAM_NO_MEM;
size = strlen(n);
}
postdata = n;