mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-10-01 01:36:01 -04:00
purge memory if munmap fails
This commit is contained in:
parent
f9a8e7216b
commit
440489af67
4
pages.c
4
pages.c
@ -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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user