mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
Delete Sliced_heap::Block object when freeing.
When a portion of the sliced heap gets freed, the corresponding block gets removed from the list of blocks, and it's dataspace containing the block gets detached, but it's destructor never gets called. This leads to leaking capabilities, when Native_capability is implemented as smart-pointer, because the destructor of Ram_dataspace_capability that is part of the Block object gets never called.
This commit is contained in:
parent
ca004658d9
commit
d1c7d64c2c
@ -29,6 +29,8 @@ namespace Genode {
|
||||
inline void *operator new(size_t size, void *at_addr) {
|
||||
return at_addr; }
|
||||
|
||||
inline void operator delete (void*) { }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -106,6 +108,7 @@ void Sliced_heap::free(void *addr, size_t size)
|
||||
_block_list.remove(b);
|
||||
_consumed -= b->size();
|
||||
Ram_dataspace_capability ds_cap = b->ds_cap();
|
||||
delete b;
|
||||
_rm_session->detach(b);
|
||||
_ram_session->free(ds_cap);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user