From: Lou Berger Date: Tue, 12 Jan 2016 18:41:47 +0000 (-0500) Subject: lib: treat realloc of null pointer as alloc Now use zalloc rather than alloc with... X-Git-Tag: frr-2.0-rc1~693 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=1567811710eb000d41ade0b465fdf43c070aabc0;p=matthieu%2Ffrr.git 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) --- 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);