purge memory if munmap fails

This commit is contained in:
Daniel Micay 2021-05-12 01:05:39 -04:00
parent f9a8e7216b
commit 440489af67

View File

@ -86,5 +86,7 @@ void *allocate_pages_aligned(size_t usable_size, size_t alignment, size_t guard_
} }
void deallocate_pages(void *usable, size_t usable_size, size_t guard_size) { void deallocate_pages(void *usable, size_t usable_size, size_t guard_size) {
memory_unmap((char *)usable - guard_size, usable_size + guard_size * 2); if (unlikely(memory_unmap((char *)usable - guard_size, usable_size + guard_size * 2))) {
memory_purge(usable, usable_size);
}
} }