mempool:add check for double free check for mempool free

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-08-11 14:42:59 +08:00 committed by Xiang Xiao
parent 0fb103bc66
commit e053dcc9f4

View File

@ -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 *)((FAR char *)blk + pool->blocksize);
/* Check double free */
DEBUGASSERT(list_in_list(&buf->node));
list_delete(&buf->node);
#else
pool->nalloc--;