Skip to content

Commit

Permalink
add check if hypervisor_allocator() exists in the generic_free() method
Browse files Browse the repository at this point in the history
This fixes crash that occurred if memory was freed/deleted before
the hypervisor_allocator is initialized.
  • Loading branch information
wbenny committed Jan 6, 2020
1 parent 7b976e6 commit 50fd7bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/lib/mm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 50fd7bb

Please sign in to comment.