tool: fix memory mixups

memory allocated by libcurl must be freed with curl_free() and vice versa,
memory allocated by the tool itself must be freed with curlx_free().

- dynbuf: free libcurl data with curl_free()
- tool_operate: make sure we get URL using the right memory
- tool_operhlp: free libcurl memory with curl_free()
- tool_operate: free curl_maprintf() pointer with curl_free
- var: data from curlx_base64_decode needs curlx_free
- tool_operate: fix memory juggling in etag handling
- tool_cb_hdr: fix memory area mixups
- tool_operate: another mixup in etag management
- tool_cb_hdr: more memory mixup fixes
- tool_cfgable.c: document some details
- tool_help: show global-mem-debug in -V output

Closes #21099
This commit is contained in:
Daniel Stenberg 2026-03-24 16:44:48 +01:00
parent 46d0ade086
commit b71973c115
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 69 additions and 28 deletions

View file

@ -153,7 +153,7 @@ static ParameterError varfunc(char *c, /* content */
/* put it in the output */
if(curlx_dyn_addn(out, enc, elen))
err = PARAM_NO_MEM;
curl_free(enc);
curlx_free(enc);
if(err)
break;
}
@ -173,7 +173,7 @@ static ParameterError varfunc(char *c, /* content */
else {
if(curlx_dyn_addn(out, enc, elen))
err = PARAM_NO_MEM;
curl_free(enc);
curlx_free(enc);
}
if(err)
break;