Fix: lttng-add-context: leak of application context parameters
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 27 Jul 2023 18:59:40 +0000 (14:59 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 28 Jul 2023 19:45:02 +0000 (15:45 -0400)
This commit backports 37d11aa60 and ca400a290, see their respective
messages.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iaf1c09acda09f592d5b5189ade4b3181e931cd7d

src/bin/lttng/commands/add_context.c

index 2793955f458e6c1ab0fdd6058f9a474deb8ba520..65f329af1ef3cc9b9a7968b11f93001a7c46d695 100644 (file)
@@ -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);
This page took 0.026872 seconds and 4 git commands to generate.