Skip to content

Commit b6ab935

Browse files
committed
fix: #12
1 parent 1aeb8e5 commit b6ab935

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

memorypool.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ MemoryPool* MemoryPoolInit(mem_size_t maxmempoolsize, mem_size_t mempoolsize) {
161161

162162
char* s = (char*) malloc(sizeof(_MP_Memory) +
163163
sizeof(char) * mp->mem_pool_size);
164-
if (!s) return NULL;
164+
if (!s) {
165+
free(mp);
166+
return NULL;
167+
}
165168

166169
mp->mlist = (_MP_Memory*) s;
167170
mp->mlist->start = s + sizeof(_MP_Memory);

0 commit comments

Comments
 (0)