From 84ea9c994aacbb341f648acad5fa10edc520dde2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 23 Nov 2011 07:19:48 +0100 Subject: [PATCH 1/1] Cleanup and streamline kernel and ust teardown session Signed-off-by: Mathieu Desnoyers --- lttng-sessiond/main.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index dd7ee0d4b..bc745487b 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -335,21 +335,19 @@ error: */ static void teardown_kernel_session(struct ltt_session *session) { - if (session->kernel_session != NULL) { - DBG("Tearing down kernel session"); - - /* - * If a custom kernel consumer was registered, close the socket before - * tearing down the complete kernel session structure - */ - if (session->kernel_session->consumer_fd != kconsumer_data.cmd_sock) { - lttcomm_close_unix_sock(session->kernel_session->consumer_fd); - } + if (!session->kernel_session) + return; + DBG("Tearing down kernel session"); - trace_kernel_destroy_session(session->kernel_session); - /* Extra precaution */ - session->kernel_session = NULL; + /* + * If a custom kernel consumer was registered, close the socket before + * tearing down the complete kernel session structure + */ + if (session->kernel_session->consumer_fd != kconsumer_data.cmd_sock) { + lttcomm_close_unix_sock(session->kernel_session->consumer_fd); } + + trace_kernel_destroy_session(session->kernel_session); } /* @@ -360,10 +358,9 @@ static void teardown_ust_session(struct ltt_session *session) { int ret; - DBG("Tearing down UST session(s)"); - if (!session->ust_session) return; + DBG("Tearing down UST session(s)"); ret = ust_app_destroy_trace_all(session->ust_session); if (ret) { ERR("Error in ust_app_destroy_trace_all"); -- 2.34.1