[lttng-dev] [PATCH babeltrace] Fix: Undefined behavior of double free on strlist in get_names_args

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Feb 28 17:54:29 EST 2013


* Christian Babeux (christian.babeux at efficios.com) wrote:
> 
> Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
> ---
>  converter/babeltrace.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/converter/babeltrace.c b/converter/babeltrace.c
> index 20ded00..28c63cb 100644
> --- a/converter/babeltrace.c
> +++ b/converter/babeltrace.c
> @@ -205,6 +205,7 @@ static int get_names_args(poptContext *pc)
>  		} else {
>  			fprintf(stderr, "[error] unknown field name type %s\n", str);
>  			free(strlist);
> +			strlist = NULL;

could we just remove the free(strlist), and just have:

   ret = -EINVAL;
   goto end;

instead ?

Thanks,

Mathieu

>  			ret = -EINVAL;
>  			goto end;
>  		}
> -- 
> 1.8.1.3
> 


-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list