SimpleHeapAllocator bug when splitting blocks allowed memory overrun.

This commit is contained in:
Christoffer Lerno
2024-11-21 13:36:24 +01:00
parent f3bf9eb14d
commit 22f7faf60e
2 changed files with 2 additions and 1 deletions

View File

@@ -98,7 +98,7 @@ fn void*! SimpleHeapAllocator._alloc(&self, usz bytes) @local
return current + 1;
case current.size > aligned_bytes:
Header* unallocated = (Header*)((char*)current + aligned_bytes + Header.sizeof);
unallocated.size = current.size - aligned_bytes;
unallocated.size = current.size - aligned_bytes - Header.sizeof;
unallocated.next = current.next;
if (current == self.free_list)
{