From: Jonathan Rajotte Date: Wed, 2 Mar 2022 15:24:29 +0000 (-0500) Subject: Fix: sessiond: use after free X-Git-Tag: v2.13.5~28 X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=a82a898cef0c32644b37fda4daf5253e93f34110 Fix: sessiond: use after free Introduced by 88b02a8e7cbdbc728cc681cd07bbe0c738964717 Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I9b1c3eeed7e51976af1a4982fc522066b3b29461 --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 9bdfab141..28c1290ad 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -3786,14 +3786,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();