summaryrefslogtreecommitdiffstats
path: root/lib/memory.c
diff options
context:
space:
mode:
authorpaco <paco@voltanet.io>2018-06-13 18:38:46 +0200
committerpaco <paco@voltanet.io>2018-06-13 19:53:09 +0200
commit4ac99370b0f4556dc8a790af6dea2bf643536b88 (patch)
treeedfff71c8140737769cb7ba26f7832b4b51c78e3 /lib/memory.c
parentMerge pull request #2421 from pacovn/Coverity_1399232_Logically_dead_code (diff)
downloadfrr-4ac99370b0f4556dc8a790af6dea2bf643536b88.tar.xz
frr-4ac99370b0f4556dc8a790af6dea2bf643536b88.zip
lib: null check (Coverity 1436343)
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'lib/memory.c')
-rw-r--r--lib/memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/memory.c b/lib/memory.c
index 318c381bf..e279b17d1 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -81,7 +81,7 @@ void *qrealloc(struct memtype *mt, void *ptr, size_t size)
void *qstrdup(struct memtype *mt, const char *str)
{
- return mt_checkalloc(mt, strdup(str), strlen(str) + 1);
+ return str ? mt_checkalloc(mt, strdup(str), strlen(str) + 1) : NULL;
}
void qfree(struct memtype *mt, void *ptr)