зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1863120 - SharedMemory::FindFreeAddressSpace performs incorrect munmap on allocation failure. r=jld.
SharedMemory::FindFreeAddressSpace will bogusly try to do `munmap(MAP_FAILED, size)` if the preceding `mmap` fails. This patch guards the `munmap` with a failure check. Differential Revision: https://phabricator.services.mozilla.com/D192799
This commit is contained in:
Родитель
7cc44b55a0
Коммит
3c2f4aaaa5
|
@ -529,8 +529,11 @@ bool SharedMemory::Map(size_t bytes, void* fixed_address) {
|
|||
void* SharedMemory::FindFreeAddressSpace(size_t size) {
|
||||
void* memory = mmap(nullptr, size, PROT_NONE,
|
||||
MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE, -1, 0);
|
||||
if (memory == MAP_FAILED) {
|
||||
return nullptr;
|
||||
}
|
||||
munmap(memory, size);
|
||||
return memory != MAP_FAILED ? memory : NULL;
|
||||
return memory;
|
||||
}
|
||||
|
||||
SharedMemoryHandle SharedMemory::CloneHandle() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче