Skip to content
Commit 132b2b8c authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Kumar Gala
Browse files

mempool: trap on double-free instances



A double-free could cause very hard to find bugs when using the mempool
allocator as the same memory would end up being allocated twice
afterwards.

Now that bits in the block bitmap are cleared only when actually freeing
a block, we may simply ensure those bits are still set before clearing
them, effectively catching most double-free cases.

The alloc_bit_is_set() function is made static inline so that when
assertion checks are disabled the compiler won't complain about unused
code.

Signed-off-by: default avatarNicolas Pitre <npitre@baylibre.com>
parent b6b7cc34
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment