summaryrefslogtreecommitdiff
path: root/lib/memory.c
diff options
context:
space:
mode:
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 318c381bf5..e279b17d12 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)