From 035559144558df2c61c067b8e327a85d31f7e740 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 3 May 2013 14:35:07 +0200 Subject: [PATCH] lx_hybrid: Safety check when freeing thread Try to free the metadata of a thread only if created by Genode. The code did not cause any actual problems. I just stumbled over the inconsistency while reviewing the code. --- base-linux/src/platform/lx_hybrid.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base-linux/src/platform/lx_hybrid.cc b/base-linux/src/platform/lx_hybrid.cc index ec1cb95f75..d4563449bb 100644 --- a/base-linux/src/platform/lx_hybrid.cc +++ b/base-linux/src/platform/lx_hybrid.cc @@ -450,7 +450,12 @@ Thread_base::~Thread_base() ret, errno); } - destroy(env()->heap(), _tid.meta_data); + Thread_meta_data_created *meta_data = + dynamic_cast(_tid.meta_data); + + if (meta_data) + destroy(env()->heap(), meta_data); + _tid.meta_data = 0; /* inform core about the killed thread */