From: Daniel Stenberg Date: Thu, 8 May 2025 08:40:17 +0000 (+0200) Subject: curlx: simplify the curlx_unicodefree macro X-Git-Tag: curl-8_14_0~130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1c6fc0cd2b36384aad4d4425383e99b56e370c91;p=thirdparty%2Fcurl.git curlx: simplify the curlx_unicodefree macro - explain its purpose in a comment Closes #17287 --- diff --git a/lib/curlx/multibyte.h b/lib/curlx/multibyte.h index 3b7d24a090..7835fdc3b5 100644 --- a/lib/curlx/multibyte.h +++ b/lib/curlx/multibyte.h @@ -81,12 +81,7 @@ typedef union { #endif /* UNICODE && _WIN32 */ -#define curlx_unicodefree(ptr) \ - do { \ - if(ptr) { \ - (free)(CURL_UNCONST(ptr)); \ - (ptr) = NULL; \ - } \ - } while(0) +/* the purpose of this macro is to free() without being traced by memdebug */ +#define curlx_unicodefree(ptr) (free)(CURL_UNCONST(ptr)) #endif /* HEADER_CURL_MULTIBYTE_H */ diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 6631c0c67f..486385ad45 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -3063,8 +3063,10 @@ ParameterError parse_args(struct GlobalConfig *global, int argc, &used, global, config); } - if(!result) + if(!result) { unicodefree(orig_opt); + orig_opt = NULL; + } } if(!result && config->content_disposition) {