This changes the behavior of p_free(pool, some_null_pointer) slightly.
datastack mempools:
Previously, the datastack frame id was checked regardless of whether or
not the pointer was NULL. Now, only non-NULL pointers perform this
check.
system mempools:
Previously, the process would SIGSEGV if a NULL pointer was freed in a
debug binary on a system with malloc_usable_size(). Now, no SIGSEGV
occurs.
allocfree, alloconly, and unsafe datastack:
No change in behavior.
{
struct allocfree_pool *apool =
container_of(pool, struct allocfree_pool, pool);
- if (mem == NULL)
- return;
struct pool_block *block = pool_block_detach(apool, mem);
if (apool->clean_frees)
safe_memset(block, 0, SIZEOF_POOLBLOCK+block->size);
static inline void p_free_internal(pool_t pool, void *mem)
{
- pool->v->free(pool, mem);
+ if (mem != NULL)
+ pool->v->free(pool, mem);
}
static inline void p_clear(pool_t pool)