]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curlx: simplify the curlx_unicodefree macro
authorDaniel Stenberg <daniel@haxx.se>
Thu, 8 May 2025 08:40:17 +0000 (10:40 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 8 May 2025 09:57:58 +0000 (11:57 +0200)
- explain its purpose in a comment

Closes #17287

lib/curlx/multibyte.h
src/tool_getparam.c

index 3b7d24a090f47450dfd353df930e305925711ce4..7835fdc3b5e4cda7d3d41473d6c704424eeec09e 100644 (file)
@@ -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 */
index 6631c0c67f3ce10fdd85abfa0ece7615e20a982a..486385ad45e7178ab6918e6557ee1b9e2131e6d0 100644 (file)
@@ -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) {