From ae2275afab15b194011e92058c63039542212748 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 2 Mar 2022 10:24:29 -0500 Subject: [PATCH] Fix: sessiond: use after free MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Introduced by 88b02a8e7cbdbc728cc681cd07bbe0c738964717 Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I9b1c3eeed7e51976af1a4982fc522066b3b29461 --- src/bin/lttng-sessiond/cmd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/cmd.cpp b/src/bin/lttng-sessiond/cmd.cpp index e16f93f71..0ca7f2172 100644 --- a/src/bin/lttng-sessiond/cmd.cpp +++ b/src/bin/lttng-sessiond/cmd.cpp @@ -3785,14 +3785,15 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain, ret = lttng_channel_serialize( channel, &payload->buffer); - lttng_channel_destroy(channel); if (ret) { ERR("Failed to serialize lttng_channel: channel name = '%s'", channel->name); + lttng_channel_destroy(channel); ret_code = LTTNG_ERR_UNK; goto end; } + lttng_channel_destroy(channel); i++; } rcu_read_unlock(); -- 2.34.1