diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2024-12-03 08:10:33 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2024-12-03 08:10:33 +0000 |
| commit | 45e36abbd404ba0c4137d0b989f3774af9ac9e3c (patch) | |
| tree | 008be25ba4dab245b71f4bcd6876ff2fd0f71f1f | |
| parent | 4f7ea612982a9ee83023e43724ff53f8dce65fe0 (diff) | |
| download | teachos-45e36abbd404ba0c4137d0b989f3774af9ac9e3c.tar.xz teachos-45e36abbd404ba0c4137d0b989f3774af9ac9e3c.zip | |
fix linked_list_allocator mutex usage
| -rw-r--r-- | arch/x86_64/src/memory/heap/linked_list_allocator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86_64/src/memory/heap/linked_list_allocator.cpp b/arch/x86_64/src/memory/heap/linked_list_allocator.cpp index 01838f9..1c5c443 100644 --- a/arch/x86_64/src/memory/heap/linked_list_allocator.cpp +++ b/arch/x86_64/src/memory/heap/linked_list_allocator.cpp @@ -36,14 +36,15 @@ namespace teachos::arch::memory::heap { if (current->size >= size + min_allocatable_size()) { - return split_free_memory_block(previous, current, size); + auto memory_address = split_free_memory_block(previous, current, size); + mutex.unlock(); + return memory_address; } previous = current; current = current->next; } - mutex.unlock(); exception_handling::panic("[Linked List Allocator] Out of memory"); } |
