]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix memory logging
authorDavid Ward <david.ward@ll.mit.edu>
Wed, 13 Jan 2010 17:10:56 +0000 (20:10 +0300)
committerDenis Ovsienko <infrastation@yandex.ru>
Wed, 13 Jan 2010 17:10:56 +0000 (20:10 +0300)
* lib/memory.h
  * mtype_zcalloc(): correct function prototype
  * XFREE(): make both definitions consistent in setting
    the pointer to NULL after freeing the memory

These changes will only have an effect if MEMORY_LOG is defined
(it is not by default).

lib/memory.h

index 42eb5caec418f5887eca38861bb853ad85c7eb52..a7eddce4e13e493c04a5d7b73b822721a0fd2707 100644 (file)
@@ -46,7 +46,10 @@ extern struct mlist mlists[];
 #define XREALLOC(mtype, ptr, size)  \
   mtype_zrealloc (__FILE__, __LINE__, (mtype), (ptr), (size))
 #define XFREE(mtype, ptr) \
-  mtype_zfree (__FILE__, __LINE__, (mtype), (ptr))
+  do { \
+    mtype_zfree (__FILE__, __LINE__, (mtype), (ptr)); \
+    ptr = NULL; } \
+  while (0)
 #define XSTRDUP(mtype, str) \
   mtype_zstrdup (__FILE__, __LINE__, (mtype), (str))
 #else
@@ -69,8 +72,7 @@ extern char *zstrdup (int type, const char *str);
 
 extern void *mtype_zmalloc (const char *file, int line, int type, size_t size);
 
-extern void *mtype_zcalloc (const char *file, int line, int type, 
-                            size_t num, size_t size);
+extern void *mtype_zcalloc (const char *file, int line, int type, size_t size);
 
 extern void *mtype_zrealloc (const char *file, int line, int type, void *ptr,
                             size_t size);