diff options
author | paul <paul> | 2006-06-15 12:41:02 +0000 |
---|---|---|
committer | paul <paul> | 2006-06-15 12:41:02 +0000 |
commit | e86d59581dbab92bef413205f6805b8828cd8b99 (patch) | |
tree | 79453d664e42ad574ebd3140b680f3d71a4ca0a6 /lib/memory.h | |
parent | ebd88b8e222c0ca78ddd473b58fc00372ddba239 (diff) | |
download | quagga-e86d59581dbab92bef413205f6805b8828cd8b99.tar.bz2 quagga-e86d59581dbab92bef413205f6805b8828cd8b99.tar.xz |
[lib] Experimental: have XFREE NULL out the freed pointer
2006-06-15 Paul Jakma <paul.jakma@sun.com>
* memory.h: Experimental, have XFREE macro NULL out the freed
pointer.
Diffstat (limited to 'lib/memory.h')
-rw-r--r-- | lib/memory.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/memory.h b/lib/memory.h index 071f394e..a23c2787 100644 --- a/lib/memory.h +++ b/lib/memory.h @@ -53,7 +53,10 @@ extern struct mlist mlists[]; #define XMALLOC(mtype, size) zmalloc ((mtype), (size)) #define XCALLOC(mtype, size) zcalloc ((mtype), (size)) #define XREALLOC(mtype, ptr, size) zrealloc ((mtype), (ptr), (size)) -#define XFREE(mtype, ptr) zfree ((mtype), (ptr)) +#define XFREE(mtype, ptr) do { \ + zfree ((mtype), (ptr)); \ + ptr = NULL; } \ + while (0) #define XSTRDUP(mtype, str) zstrdup ((mtype), (str)) #endif /* MEMORY_LOG */ |