Fix: ambiguous ownership of kernel context by multiple channels
[lttng-tools.git] / src / bin / lttng-sessiond / kernel.c
index abf038f4d59a3f1c9f021123e29e947db3fd4db1..2031bfb38f4ca3825f37067a2ddbca50890e54f8 100644 (file)
@@ -36,6 +36,8 @@
 
 /*
  * Add context on a kernel channel.
+ *
+ * Assumes the ownership of ctx.
  */
 int kernel_add_channel_context(struct ltt_kernel_channel *chan,
                struct ltt_kernel_context *ctx)
@@ -67,7 +69,11 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan,
 
 end:
        cds_list_add_tail(&ctx->list, &chan->ctx_list);
+       ctx = NULL;
 error:
+       if (ctx) {
+               trace_kernel_destroy_context(ctx);
+       }
        return ret;
 }
 
This page took 0.024187 seconds and 5 git commands to generate.