diff options
author | antirez <antirez@gmail.com> | 2009-04-30 20:15:18 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2009-04-30 20:15:18 +0200 |
commit | 8d196ebac2554d77c15c38b3e730c8f85bdb26a6 (patch) | |
tree | 3f99d37d5b66b8f81eda6894a28a0829ee265bd9 /zmalloc.c | |
parent | 71aee3e959e205d3acc906c1c1cc91d7e4d87f14 (diff) | |
download | redis-8d196ebac2554d77c15c38b3e730c8f85bdb26a6.tar.gz |
zmalloc fix, return NULL or real malloc failure
Diffstat (limited to 'zmalloc.c')
-rw-r--r-- | zmalloc.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -36,6 +36,7 @@ static size_t used_memory = 0; void *zmalloc(size_t size) { void *ptr = malloc(size+sizeof(size_t)); + if (!ptr) return NULL; *((size_t*)ptr) = size; used_memory += size+sizeof(size_t); return (char*)ptr+sizeof(size_t); |