From: Jérémie Galarneau Date: Thu, 27 Jul 2023 18:59:40 +0000 (-0400) Subject: Fix: lttng-add-context: leak of application context parameters X-Git-Tag: v2.12.15~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a51eef24d40920e7e0f492290cf089ef634ac00f;p=lttng-tools.git Fix: lttng-add-context: leak of application context parameters This commit backports 37d11aa60 and ca400a290, see their respective messages. Signed-off-by: Jérémie Galarneau Change-Id: Iaf1c09acda09f592d5b5189ade4b3181e931cd7d --- diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 2793955f4..65f329af1 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -866,6 +866,10 @@ void destroy_ctx_type(struct ctx_type *type) } if (type->opt) { free(type->opt->symbol); + if (type->opt->ctx_type == CONTEXT_APP_CONTEXT) { + free(type->opt->u.app_ctx.ctx_name); + free(type->opt->u.app_ctx.provider_name); + } } free(type->opt); free(type);