mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
base: fix potential memory leak in allocator_avl
When used by the 'Allocator_avl' the slab allocator's backing store is dynamically disabled and re-enabled while adding/freeing ranges. However, during those operations, slab entries can be freed. This, in turn, can result in the release of a slab block (when the freed slab entry happens to be the last entry of the block). In this corner case, 'Slab::_release_backing_store' operation has no effect because no backing-store allocator is set. As a result, the block is no longer referenced but not physically freed. The patch fixes the problem by skipping '_free_curr_sb' whenever no backing store is defined. So the completely empty block remains in the working set. Thanks to Peter for reporting and fixing this issue! Fixes #4367
This commit is contained in:
parent
3bbe7d9d07
commit
88ca8d1a72
@ -438,7 +438,8 @@ void Slab::_free(void *addr)
|
||||
_curr_sb = █
|
||||
while (_total_avail > 2*_entries_per_block
|
||||
&& _num_blocks > 1
|
||||
&& _curr_sb->avail() == _entries_per_block) {
|
||||
&& _curr_sb->avail() == _entries_per_block
|
||||
&& _backing_store) {
|
||||
_free_curr_sb();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user