mempool:add check for double free check for mempool free
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
0fb103bc66
commit
e053dcc9f4
@ -304,6 +304,9 @@ void mempool_free(FAR struct mempool_s *pool, FAR void *blk)
|
|||||||
FAR struct mempool_backtrace_s *buf =
|
FAR struct mempool_backtrace_s *buf =
|
||||||
(FAR struct mempool_backtrace_s *)((FAR char *)blk + pool->blocksize);
|
(FAR struct mempool_backtrace_s *)((FAR char *)blk + pool->blocksize);
|
||||||
|
|
||||||
|
/* Check double free */
|
||||||
|
|
||||||
|
DEBUGASSERT(list_in_list(&buf->node));
|
||||||
list_delete(&buf->node);
|
list_delete(&buf->node);
|
||||||
#else
|
#else
|
||||||
pool->nalloc--;
|
pool->nalloc--;
|
||||||
|
Loading…
Reference in New Issue
Block a user