From 5ca5520c90f39082a9d2b123ec9e2cf65ac155cb Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 18 Apr 2024 15:58:43 +0200 Subject: [PATCH] ea_malloc: Fix `defrag_free_list` block size bug. Fixes #864. --- libraries/ea_malloc/malloc_freelist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/ea_malloc/malloc_freelist.c b/libraries/ea_malloc/malloc_freelist.c index 833597baa..aa6fed5f9 100644 --- a/libraries/ea_malloc/malloc_freelist.c +++ b/libraries/ea_malloc/malloc_freelist.c @@ -20,7 +20,7 @@ /* * This is the container for our free-list. - * Node the usage of the linked list here: the library uses offsetof + * Note the usage of the linked list here: the library uses offsetof * and container_of to manage the list and get back to the parent struct. */ typedef struct @@ -67,7 +67,7 @@ void defrag_free_list(void) { if((((uintptr_t)&lb->block) + lb->size) == (uintptr_t)b) { - lb->size += sizeof(*b) + b->size; + lb->size += ALLOC_HEADER_SZ + b->size; list_del(&b->node); continue; }