[lttng-dev] [PATCH lttng-tools] Fix: null dereference on error path for create_ctx_type

Jérémie Galarneau jeremie.galarneau at efficios.com
Thu Jan 26 00:32:54 UTC 2017


Merged in master, stable-2.9 and stable-2.8.

Thanks!
Jérémie

On 17 January 2017 at 10:08, Jonathan Rajotte
<jonathan.rajotte-julien at efficios.com> wrote:
> When zmalloc of type->opt fail the destroy_ctx_type would result in a
> null dereference.
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
>  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 5fc65bf..df722bb 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);
>  }
> --
> 2.7.4
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list