From 1c6fc0cd2b36384aad4d4425383e99b56e370c91 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 8 May 2025 10:40:17 +0200 Subject: [PATCH] curlx: simplify the curlx_unicodefree macro - explain its purpose in a comment Closes #17287 --- lib/curlx/multibyte.h | 9 ++------- src/tool_getparam.c | 4 +++- 2 files changed, 5 insertions(+), 8 deletions(-) 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) { -- 2.47.3