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:24:50 +0000 (12:24 -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 fb6f96d47f4050edd28b4eb8507aa55993764800..d76166a6e9387c965acf66c347959553686bacfc 100644 (file)
@@ -68,6 +68,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 ce5aca2edfb376d55563253d888d9afd0397e584..fa207bc67eb1adc8e18a13ba27c583424f6d8a8d 100644 (file)
@@ -484,7 +484,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 a39ccd3bb0b6d0b5fd24d9f73cf3d9764623c3f2..74bf1df1d9508029c5f7fe15554f155e6fd6615b 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.029288 seconds and 4 git commands to generate.