mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
nic_router: fix leak on domain deinit
The deinitialization method of Domain used to rely on Domain::with_dhcp_server in order to dissolve and destroy a present DHCP server. However, this method skipped calling its functor argument also when there was a DHCP server but an invalid one. This commt replaces the with_dhcp_server with a pointer null-check in order to fix the leak. Ref #4729
This commit is contained in:
parent
c96150bc70
commit
f7f171e457
@ -392,11 +392,12 @@ void Domain::deinit()
|
||||
_tcp_rules.destroy_each(_alloc);
|
||||
_udp_forward_rules.destroy_each(_alloc);
|
||||
_tcp_forward_rules.destroy_each(_alloc);
|
||||
with_dhcp_server([&] (Dhcp_server &dhcp_server) {
|
||||
_dhcp_server_ptr = nullptr;
|
||||
dhcp_server.with_dns_config_from([&] (Domain &domain) {
|
||||
if (_dhcp_server_ptr) {
|
||||
_dhcp_server_ptr->with_dns_config_from([&] (Domain &domain) {
|
||||
domain.ip_config_dependents().remove(this); });
|
||||
destroy(_alloc, &dhcp_server); });
|
||||
_dhcp_server_ptr = nullptr;
|
||||
destroy(_alloc, _dhcp_server_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user