Fix: sessiond: use after free
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 2 Mar 2022 15:24:29 +0000 (10:24 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Mar 2022 16:00:36 +0000 (11:00 -0500)
Introduced by 88b02a8e7cbdbc728cc681cd07bbe0c738964717

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9b1c3eeed7e51976af1a4982fc522066b3b29461

src/bin/lttng-sessiond/cmd.cpp

index e16f93f71881c2db7ab6de10c4f57639eaa4dd69..0ca7f217244bd81d7cba98431347d60e7f61c9b4 100644 (file)
@@ -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();
This page took 0.026978 seconds and 4 git commands to generate.