diff options
Diffstat (limited to 'src/basic/mempool.c')
-rw-r--r-- | src/basic/mempool.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/basic/mempool.c b/src/basic/mempool.c index d934aa9547..999b86d5cb 100644 --- a/src/basic/mempool.c +++ b/src/basic/mempool.c @@ -70,9 +70,16 @@ void* mempool_alloc0_tile(struct mempool *mp) { return p; } -void mempool_free_tile(struct mempool *mp, void *p) { - * (void**) p = mp->freelist; +void* mempool_free_tile(struct mempool *mp, void *p) { + assert(mp); + + if (!p) + return NULL; + + *(void**) p = mp->freelist; mp->freelist = p; + + return NULL; } void mempool_drop(struct mempool *mp) { |