summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/memdebug.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/memdebug.h b/lib/memdebug.h
index 6e778b4da..1e02645f9 100644
--- a/lib/memdebug.h
+++ b/lib/memdebug.h
@@ -152,8 +152,10 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
/*
* Curl_safefree defined as a macro to allow MemoryTracking feature
* to log free() calls at same location where Curl_safefree is used.
+ * This macro also assigns NULL to given pointer when free'd.
*/
-#define Curl_safefree(ptr) do {if((ptr)) free((ptr));} WHILE_FALSE
+#define Curl_safefree(ptr) \
+ do {if((ptr)) {free((ptr)); (ptr) = NULL;}} WHILE_FALSE
#endif /* HEADER_CURL_MEMDEBUG_H */