From da9e764c47ca91cf41da68f34a45a23b9bc814c2 Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Thu, 13 Mar 2014 13:13:21 +0100 Subject: [PATCH] Init: bugfix Fix a use-after-free bug concerning the use case where the config of the init process changes dynamically. The childs' services were not removed from the corresponding Service_registry properly. Fixes #1094 --- os/include/init/child.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/os/include/init/child.h b/os/include/init/child.h index 6e741c9480..ed0f1f9361 100644 --- a/os/include/init/child.h +++ b/os/include/init/child.h @@ -557,7 +557,12 @@ namespace Init { } catch (Xml_node::Nonexistent_sub_node) { } } - virtual ~Child() { } + virtual ~Child() { + Genode::Service *s; + while ((s = _child_services->find_by_server(&_server))) { + _child_services->remove(s); + } + } /** * Return true if the child has the specified name