summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-17 17:01:40 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-17 17:01:40 +0300
commit9e6e0e0790c6548e45eda36d7699fea51502970d (patch)
treeb653f0ab245ec5e9de3a2f5066978bf9287f2689
parente79efdeee4dd7d2d1632e1703500f9785f962f8f (diff)
downloadhercules-9e6e0e0790c6548e45eda36d7699fea51502970d.tar.gz
hercules-9e6e0e0790c6548e45eda36d7699fea51502970d.tar.bz2
hercules-9e6e0e0790c6548e45eda36d7699fea51502970d.tar.xz
hercules-9e6e0e0790c6548e45eda36d7699fea51502970d.zip
Dont call memset with null pointer.
-rw-r--r--src/common/malloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c
index d5a979e77..63de90cb3 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -343,7 +343,8 @@ void *mmalloc_(size_t size, const char *file, int line, const char *func) {
void *mcalloc_(size_t num, size_t size, const char *file, int line, const char *func) {
void *p = iMalloc->malloc(num * size,file,line,func);
- memset(p,0,num * size);
+ if (p)
+ memset(p, 0, num * size);
return p;
}