Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions mm/mm_heap/mm_free.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,8 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
return;
}

kasan_poison(mem, mm_malloc_size(mem));

if (mm_takesemaphore(heap) == false)
{
kasan_unpoison(mem, mm_malloc_size(mem));

/* Meet -ESRCH return, which means we are in situations
* during context switching(See mm_takesemaphore() & getpid()).
* Then add to the delay list.
Expand All @@ -99,6 +95,8 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
return;
}

kasan_poison(mem, mm_malloc_size(mem));

DEBUGASSERT(mm_heapmember(heap, mem));

/* Map the memory chunk into a free node */
Expand Down Expand Up @@ -175,5 +173,6 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
/* Add the merged node to the nodelist */

mm_addfreechunk(heap, node);

mm_givesemaphore(heap);
}