mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 11:27:29 +00:00
core: avoid freeing memory of unknown state
This should actually never happen. However if it happens, be a bit robuster and don't provide the memory for re-use (which causes tons of other trouble afterwards). Issue #2505
This commit is contained in:
parent
404a82d5ee
commit
cf2886dc8f
@ -77,7 +77,13 @@ void Mapped_mem_allocator::free(void *addr, size_t size)
|
||||
Block *b = static_cast<Block *>(_virt_alloc->_find_by_address((addr_t)addr));
|
||||
if (!b) return;
|
||||
|
||||
_unmap_local((addr_t)addr, (addr_t)b->map_addr, b->size());
|
||||
if (!_unmap_local((addr_t)addr, (addr_t)b->map_addr, b->size())) {
|
||||
Genode::error("error on unmap virt=", addr, " phys=",
|
||||
Hex_range<addr_t>((addr_t)b->map_addr, b->size()));
|
||||
/* leak physical and virtual region because of unknown usage state */
|
||||
return;
|
||||
}
|
||||
|
||||
_phys_alloc->free(b->map_addr, b->size());
|
||||
_virt_alloc->free(addr, b->size());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user