diff --git a/src/mpool.c b/src/mpool.c index ae71d976d..c1518e691 100644 --- a/src/mpool.c +++ b/src/mpool.c @@ -120,12 +120,7 @@ void *mpool_alloc(mpool_t *mp) void *mpool_calloc(mpool_t *mp) { - if (!mp->chunk_count && !(mpool_extend(mp))) - return NULL; - - char *ptr = (char *) mp->free_chunk_head + sizeof(memchunk_t); - mp->free_chunk_head = mp->free_chunk_head->next; - mp->chunk_count--; + char *ptr = mpool_alloc(mp); memset(ptr, 0, mp->chunk_size); return ptr; }