[lib][miniheap] fix: modify the assert condition in miniheap

For LK_DEBUGLEVEL > 1
> alloc_struct_begin_size: 24
> free_heap_chunk_size: 24

size: max(alloc_struct_begin_size, free_heap_chunk_size)

But when freeing the chunk, allocated size is expected to be
greater than size of free_heap_chunk struct.
It contradicts its own code.
So add >= instead of > to maintain the integrity between
allocation and freeing of memory chunk.

Signed-off-by: vivek.j <vivek.j@samsung.com>
This commit is contained in:
vivek.j
2025-02-27 17:05:50 +05:30
committed by Travis Geiselbrecht
parent 4ff60704a5
commit 322ff67050

View File

@@ -149,7 +149,7 @@ try_merge:
static struct free_heap_chunk *heap_create_free_chunk(void *ptr, size_t len, bool allow_debug) {
DEBUG_ASSERT((len % sizeof(void *)) == 0); // size must be aligned on pointer boundary
DEBUG_ASSERT(len > sizeof(struct free_heap_chunk));
DEBUG_ASSERT(len >= sizeof(struct free_heap_chunk));
#if DEBUG_HEAP
if (allow_debug)