From 1567811710eb000d41ade0b465fdf43c070aabc0 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 12 Jan 2016 13:41:47 -0500 Subject: [PATCH] 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 (cherry picked from commit 9248b61f54955e56212f3ae4c8a7ab704f7ad01c) --- lib/memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/memory.c b/lib/memory.c index 93ff702ca0..8e1f41d7f3 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); -- 2.39.5