Fix: ambiguous ownership of kernel context by multiple channels
[lttng-tools.git] / src / bin / lttng-sessiond / kernel.c
index 78978a234a6d8cf53b5011aaf728340462b3206c..8dc3f86314d5aab8b94bf623942ec1ee404ad959 100644 (file)
@@ -37,6 +37,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,9 +69,11 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan,
 
 end:
        cds_list_add_tail(&ctx->list, &chan->ctx_list);
-       return 0;
-
+       ctx = NULL;
 error:
+       if (ctx) {
+               trace_kernel_destroy_context(ctx);
+       }
        return ret;
 }
 
This page took 0.023154 seconds and 4 git commands to generate.