From: Jonathan Rajotte Date: Tue, 17 Jan 2017 15:08:47 +0000 (-0500) Subject: Fix: null dereference on error path for create_ctx_type X-Git-Tag: v2.9.4~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=326cf26a600fa17813b830322f2beb9a74955a1e;p=lttng-tools.git Fix: null dereference on error path for create_ctx_type 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 --- diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 5fc65bf55..df722bb24 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -662,7 +662,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); }