Fix: null dereference on error path for create_ctx_type
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 17 Jan 2017 15:08:47 +0000 (10:08 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 25 Jan 2017 23:35:17 +0000 (18:35 -0500)
When zmalloc of type->opt fail the destroy_ctx_type would result in a
null dereference.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/add_context.c

index 5fc65bf556e7db963659e74dcbf0c90e27b44264..df722bb249f39ef8ee28107c501a3b668998ca49 100644 (file)
@@ -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);
 }
This page took 0.026767 seconds and 5 git commands to generate.