summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLou Berger <lberger@labn.net>2016-01-12 13:41:47 -0500
committerPaul Jakma <paul.jakma@hpe.com>2016-02-26 14:11:41 +0000
commit9248b61f54955e56212f3ae4c8a7ab704f7ad01c (patch)
treed97f0d05991233191a400e6acaa6a164594a2d59 /lib
parent672900382d47137638086bd8351b2678f589a546 (diff)
downloadquagga-9248b61f54955e56212f3ae4c8a7ab704f7ad01c.tar.bz2
quagga-9248b61f54955e56212f3ae4c8a7ab704f7ad01c.tar.xz
lib: treat realloc of null pointer as alloc Now use zalloc rather than alloc with null. Fixes issue seen in bgp check tests.
Signed-off-by: Lou Berger <lberger@labn.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/memory.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/memory.c b/lib/memory.c
index 172ddfc4..269520d5 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -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);