mm: check double free before adding to delaylist

If free memory is delayed, check case of double free in the first
place.

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Xu Xingliang 2024-05-28 13:25:41 +08:00 committed by Alan Carvalho de Assis
parent 24af23e49c
commit b5f8498142

View file

@ -48,6 +48,13 @@ static void add_delaylist(FAR struct mm_heap_s *heap, FAR void *mem)
flags = up_irq_save();
# ifdef CONFIG_DEBUG_ASSERTIONS
FAR struct mm_freenode_s *node;
node = (FAR struct mm_freenode_s *)((FAR char *)mem - MM_SIZEOF_ALLOCNODE);
DEBUGASSERT(MM_NODE_IS_ALLOC(node));
# endif
tmp->flink = heap->mm_delaylist[this_cpu()];
heap->mm_delaylist[this_cpu()] = tmp;