From 0edabd6d8717e4aa65618e3c588a94c274c71081 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 5 Dec 2022 21:00:21 +0100 Subject: [PATCH] Heap: Add a new block to the end of the linked list *facepalm* This was causing page faults when having two blocks and the first one (oldest one) being freed first. --- kernel/src/memory/Heap.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index a95244be..5887e7dc 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -222,6 +222,7 @@ Result kmalloc(usize size) block->status = BLOCK_START_MEM | BLOCK_END_MEM; block->next = nullptr; block->last = heap_end; + heap_end->next = block; heap_end = block; }