From e74bc0ba0ea42594eaad0c4d4dd95a9dbe7d4334 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 17 Jan 2017 10:08:47 -0500 Subject: [PATCH] Fix: null dereference on error path for create_ctx_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When zmalloc of type->opt fail the destroy_ctx_type would result in a null dereference. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- src/bin/lttng/commands/add_context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 2f43dc7ff..479e3fe4d 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -661,7 +661,9 @@ void destroy_ctx_type(struct ctx_type *type) if (!type) { return; } - free(type->opt->symbol); + if (type->opt) { + free(type->opt->symbol); + } free(type->opt); free(type); } -- 2.34.1