Fix: ensure kernel context is in a list before trying to delete it
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 2 Aug 2017 20:49:44 +0000 (16:49 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Aug 2017 16:09:00 +0000 (12:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/trace-kernel.h

index 2031bfb38f4ca3825f37067a2ddbca50890e54f8..2cbed381870a096350a4e8ac77ec39845850d0f1 100644 (file)
@@ -69,6 +69,7 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan,
 
 end:
        cds_list_add_tail(&ctx->list, &chan->ctx_list);
+       ctx->in_list = true;
        ctx = NULL;
 error:
        if (ctx) {
index 54bdc667575ec48a0b2d5ac3fadcc999148150ae..52b8cc7e0e8d4f2d4e017d746def763f599d9420 100644 (file)
@@ -501,7 +501,9 @@ void trace_kernel_destroy_context(struct ltt_kernel_context *ctx)
 {
        assert(ctx);
 
-       cds_list_del(&ctx->list);
+       if (ctx->in_list) {
+               cds_list_del(&ctx->list);
+       }
        free(ctx);
 }
 
index 0ac020f97d63b4d00d599ec2ee2597a8bbe44d2f..2eb599272a0ceb15ce167b73b9e68ae37e9528f4 100644 (file)
@@ -45,6 +45,8 @@ struct ltt_kernel_channel_list {
 struct ltt_kernel_context {
        struct lttng_kernel_context ctx;
        struct cds_list_head list;
+       /* Indicates whether or not the context is in a list. */
+       bool in_list;
 };
 
 /* Kernel event */
This page took 0.02689 seconds and 4 git commands to generate.