From bcb7f45201915b6e7afba7fab7c40f2f7cb749f8 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 17 Dec 2019 13:25:11 +0100 Subject: [PATCH] core: avoid dangling ptr in cpu thread component if exception is triggered during construction of a thread --- repos/base/src/core/include/cpu_thread_component.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/repos/base/src/core/include/cpu_thread_component.h b/repos/base/src/core/include/cpu_thread_component.h index 37cd62603b..8a0de44fe7 100644 --- a/repos/base/src/core/include/cpu_thread_component.h +++ b/repos/base/src/core/include/cpu_thread_component.h @@ -152,8 +152,6 @@ class Genode::Cpu_thread_component : public Rpc_object, _platform_thread.affinity(), pd.label(), name) { - _address_space_region_map.add_client(_rm_client); - /* * Acquaint thread with its pager object, caution on some base platforms * this may raise an 'Out_of_ram' exception, which causes the @@ -167,6 +165,7 @@ class Genode::Cpu_thread_component : public Rpc_object, throw; } + _address_space_region_map.add_client(_rm_client); _platform_thread.pager(_rm_client); _trace_sources.insert(&_trace_source); }