X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcontext.c;h=cd4b85f2a9d576ff828617075e1f305120d69659;hb=e04aa23e052089bfd9aaa577f6a6972fb058b650;hp=10352d026952ec3361acccf6aa07ac97bab4b34f;hpb=645328ae989e5f50a3a49c1ac34b2fee287a3d7b;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/context.c b/src/bin/lttng-sessiond/context.c index 10352d026..cd4b85f2a 100644 --- a/src/bin/lttng-sessiond/context.c +++ b/src/bin/lttng-sessiond/context.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -198,7 +199,8 @@ int context_kernel_add(struct ltt_kernel_session *ksession, kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER; break; default: - return LTTNG_ERR_KERN_CONTEXT_FAIL; + ret = LTTNG_ERR_KERN_CONTEXT_FAIL; + goto error; } kctx->ctx.u.perf_counter.type = ctx->u.perf_counter.type; @@ -226,9 +228,12 @@ int context_kernel_add(struct ltt_kernel_session *ksession, } } - ret = LTTNG_OK; + return LTTNG_OK; error: + if (kctx) { + trace_kernel_destroy_context(kctx); + } return ret; }