]> git.proxmox.com Git - mirror_frr.git/commitdiff
[lib] Experimental: have XFREE NULL out the freed pointer
authorPaul Jakma <paul.jakma@sun.com>
Thu, 15 Jun 2006 12:41:02 +0000 (12:41 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Thu, 15 Jun 2006 12:41:02 +0000 (12:41 +0000)
2006-06-15 Paul Jakma <paul.jakma@sun.com>

* memory.h: Experimental, have XFREE macro NULL out the freed
  pointer.

lib/ChangeLog
lib/memory.h

index b2ec068136778699a2861272b18afd2448cd8fb3..b7c9f0403500318fe702b3e1f85a1c30f42d0561 100644 (file)
@@ -1,6 +1,8 @@
 2006-06-15 Paul Jakma <paul.jakma@sun.com>
 
        * command.c: (cmd_describe_command_real) Fix leak, CID #38.
+       * memory.h: Experimental, have XFREE macro NULL out the freed
+         pointer.
 
 2006-05-28 Paul Jakma <paul.jakma@sun.com>
 
index 071f394e241643c6b5632574a3fc39ee14e0d51b..a23c27875e436c027ea6a5fdc4e06a362b86c12e 100644 (file)
@@ -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 */