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:37:45 +0000 (18:37 -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 2f43dc7ff203e53a411d7178e649d80dd590d824..479e3fe4d86e849d1d42793a73c09d61fde3d88e 100644 (file)
@@ -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);
 }
This page took 0.026801 seconds and 4 git commands to generate.