From: Mathieu Desnoyers Date: Wed, 23 Nov 2011 06:19:48 +0000 (+0100) Subject: Cleanup and streamline kernel and ust teardown session X-Git-Tag: v2.0-pre15~84 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=84ea9c994aacbb341f648acad5fa10edc520dde2;p=lttng-tools.git Cleanup and streamline kernel and ust teardown session Signed-off-by: Mathieu Desnoyers --- 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");