From f7abde02150deacbc2ad1957e6165769cc2fea0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Mon, 2 Dec 2024 12:43:24 +0000 Subject: Add comment on extra double deallocation check --- arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch') diff --git a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp index e8ecc30..6af6298 100644 --- a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp +++ b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp @@ -74,6 +74,9 @@ namespace teachos::arch::memory::heap * increases by the amount in the current memory block header. After reading it we also clear the header. * 4. If the previous block is adjacent the size of the previous block simply increases to include the given size as * well. + * 5. If the previous block is directly in our start address, so they overlap then it has to mean some or all of the + * region we are trying to deallocate has been freed before. Which would result in a double free therefore we halt + * the execution of the program. * * @param previous_block Free memory block before the block to deallocate in our heap memory. * @param current_block Free memory block after the block to deallocate in our heap memory. -- cgit v1.2.3