add check if hypervisor_allocator() exists in the generic_free() method

This fixes crash that occurred if memory was freed/deleted before
the hypervisor_allocator is initialized.
This commit is contained in:
Petr Benes 2020-01-05 17:07:40 +01:00
parent 7b976e63a3
commit 50fd7bbc2d

View file

@ -126,7 +126,7 @@ namespace detail
void generic_free(void* address) noexcept
{
return mm::hypervisor_allocator()->contains(address)
return (mm::hypervisor_allocator() && mm::hypervisor_allocator()->contains(address))
? mm::hypervisor_allocator()->free(address)
: mm::system_allocator()->free(address);
}