mm/mm_extend: Increase total heap size accordingly

When adding more heap memory, the total heap size was not updated. This
results in a crash in mm_mallinfo:

DEBUGASSERT((size_t)info->uordblks + info->fordblks == heap->mm_heapsize);

This commit fixes this issue
This commit is contained in:
Ville Juven 2023-01-19 08:32:56 +02:00 committed by Xiang Xiao
parent 82550887c2
commit 6c2e0b7333

View File

@ -106,6 +106,10 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size,
newnode->preceding = oldnode->size | MM_ALLOC_BIT; newnode->preceding = oldnode->size | MM_ALLOC_BIT;
heap->mm_heapend[region] = newnode; heap->mm_heapend[region] = newnode;
/* Finally, increase the total heap size accordingly */
heap->mm_heapsize += size;
mm_unlock(heap); mm_unlock(heap);
/* Finally "free" the new block of memory where the old terminal node was /* Finally "free" the new block of memory where the old terminal node was