aboutsummaryrefslogtreecommitdiffstats
path: root/src/free_list.c
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 18:29:43 -0500
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 18:29:43 -0500
commitb315442b947dbf4909ca03e4fff2548493ceff9c (patch)
tree85e35491f8d47fecf0f5132a64904ca1403b091f /src/free_list.c
parent11521b99661f969ba7adad9d2366108a1a001ab0 (diff)
downloadliballoc-b315442b947dbf4909ca03e4fff2548493ceff9c.tar.gz
free_list: Update header sizes when coalescing free blocks
Diffstat (limited to 'src/free_list.c')
-rw-r--r--src/free_list.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/free_list.c b/src/free_list.c
index 0ecb23f..bc93196 100644
--- a/src/free_list.c
+++ b/src/free_list.c
@@ -60,6 +60,7 @@ void fl_coalesce_nodes(free_nd *free_list) {
for (free_nd *nd = free_list; nd; nd = nd->next) {
if ((size_t)nd + sizeof(header) + nd->size == (size_t)nd->next) {
nd->size += sizeof(header) + nd->next->size;
+ ((header *)((void *)nd - sizeof(header)))->size += sizeof(header) + nd->next->size;
nd->next = nd->next->next;
}
}