From: Paul Jakma Date: Thu, 15 Jun 2006 12:41:02 +0000 (+0000) Subject: [lib] Experimental: have XFREE NULL out the freed pointer X-Git-Tag: frr-2.0-rc1~2672 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8ce5cfd13eb7f8474b3129a57c160273889c2573;p=matthieu%2Ffrr.git [lib] Experimental: have XFREE NULL out the freed pointer 2006-06-15 Paul Jakma * memory.h: Experimental, have XFREE macro NULL out the freed pointer. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index b2ec068136..b7c9f04035 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,6 +1,8 @@ 2006-06-15 Paul Jakma * 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 diff --git a/lib/memory.h b/lib/memory.h index 071f394e24..a23c27875e 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 */