diff options
| author | Lou Berger <lberger@labn.net> | 2016-01-12 13:41:47 -0500 |
|---|---|---|
| committer | Daniel Walton <dwalton@cumulusnetworks.com> | 2016-05-26 15:33:33 +0000 |
| commit | 1567811710eb000d41ade0b465fdf43c070aabc0 (patch) | |
| tree | 389e1993856cd5b3cffb28308870d01c2daeb80a /lib/memory.c | |
| parent | c54632ec18a01e48b9a8d688231088faa534c29c (diff) | |
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>
(cherry picked from commit 9248b61f54955e56212f3ae4c8a7ab704f7ad01c)
Diffstat (limited to 'lib/memory.c')
| -rw-r--r-- | lib/memory.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |
