mm/kmm_heap: Free memory when it is not NULL
A memory should be freed when it it not NULL.
void kmm_free(FAR void *mem)
{
- struct mm_heap_s *kheap = mm_get_heap(mem);
+ struct mm_heap_s *kheap;
+
+ if (mem) {
DEBUGASSERT(kmm_heapmember(mem));
+ kheap = mm_get_heap(mem);
mm_free(kheap, mem);
}
+}
#endif /* CONFIG_MM_KERNEL_HEAP */
