mirror of
https://github.com/fluencelabs/redis
synced 2025-03-31 14:51:04 +00:00
zmalloc fix, return NULL or real malloc failure
This commit is contained in:
parent
71aee3e959
commit
8d196ebac2
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user