summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/malloc_simple.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index c14f8b59c1..871b5444bd 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -57,7 +57,8 @@ void *calloc(size_t nmemb, size_t elem_size)
void *ptr;
ptr = malloc(size);
- memset(ptr, '\0', size);
+ if (ptr)
+ memset(ptr, '\0', size);
return ptr;
}