X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel.c;h=2cbed381870a096350a4e8ac77ec39845850d0f1;hb=12e22e8d2e314f048583a240a0d703fa9cfc7869;hp=b32193451f2060c401ac9d7503f2e48574be3fe4;hpb=6e21424e11f47edb885c7f92ae1cae69eee0ed8e;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index b32193451..2cbed3818 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -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) @@ -63,12 +65,16 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan, goto error; } } + ret = 0; end: cds_list_add_tail(&ctx->list, &chan->ctx_list); - return 0; - + ctx->in_list = true; + ctx = NULL; error: + if (ctx) { + trace_kernel_destroy_context(ctx); + } return ret; }