mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Make Curl_safefree() macro assign NULL to given pointer when free'd
This commit is contained in:
parent
f7583b2dea
commit
ff9d858722
@ -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
|
* Curl_safefree defined as a macro to allow MemoryTracking feature
|
||||||
* to log free() calls at same location where Curl_safefree is used.
|
* 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 */
|
#endif /* HEADER_CURL_MEMDEBUG_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user