]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: treat realloc of null pointer as alloc Now use zalloc rather than alloc with...
authorLou Berger <lberger@labn.net>
Tue, 12 Jan 2016 18:41:47 +0000 (13:41 -0500)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 26 May 2016 15:33:33 +0000 (15:33 +0000)
Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit 9248b61f54955e56212f3ae4c8a7ab704f7ad01c)

lib/memory.c

index 93ff702ca0699aab3bb6a6e45ec8c6f28b8cd33f..8e1f41d7f3b7d0721abbafbdf5ffd617ecdc891b 100644 (file)
@@ -108,6 +108,9 @@ zrealloc (int type, void *ptr, size_t size)
 {
   void *memory;
 
+  if (ptr == NULL)              /* is really alloc */
+      return zcalloc(type, size);
+
   memory = realloc (ptr, size);
   if (memory == NULL)
     zerror ("realloc", type, size);