Fix: ambiguous ownership of kernel context by multiple channels
[lttng-tools.git] / src / bin / lttng-sessiond / kernel.c
index e478499336896f5d739e087c8ee91e3a395886cd..fb6f96d47f4050edd28b4eb8507aa55993764800 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)
@@ -66,9 +68,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.022944 seconds and 4 git commands to generate.