diff options
author | Yang Tse <yangsita@gmail.com> | 2011-09-15 17:35:23 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-09-15 17:35:23 +0200 |
commit | ff9d85872248f360aa76791b050872fb332a1ea0 (patch) | |
tree | 7c436a9007a5b059c15ee8b4556fb48d7a79e77e /lib | |
parent | f7583b2dea9fcbc9771ff49cc55e5e934fee3894 (diff) | |
download | curl-ff9d85872248f360aa76791b050872fb332a1ea0.tar.gz |
Make Curl_safefree() macro assign NULL to given pointer when free'd
Diffstat (limited to 'lib')
-rw-r--r-- | lib/memdebug.h | 4 |
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 */ |