Fix: sessiond: use after free
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 9bdfab141263d203ff2a93ae8c39070a1ffa121a..28c1290adfb59467d2c3cdef8be3c58beba187eb 100644 (file)
@@ -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();
This page took 0.040269 seconds and 4 git commands to generate.