[Mesa-dev] [PATCH] gallium/tgsi: fix memory leak in tgsi sanity check

Marc-André Lureau mlureau at redhat.com
Mon Jan 23 12:02:19 UTC 2017


Hi

----- Original Message -----
> Fix the leak of some ctx fields in error path.
> 
> Signed-off-by: Li Qiang <liq3ea at gmail.com>
> ---
>  src/gallium/auxiliary/tgsi/tgsi_sanity.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
> b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
> index f867925..c3d5094 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
> @@ -580,8 +580,12 @@ tgsi_sanity_check(
>     ctx.implied_array_size = 0;
>     ctx.print = debug_get_option_print_sanity();
>  
> -   if (!tgsi_iterate_shader( tokens, &ctx.iter ))
> +   if (!tgsi_iterate_shader( tokens, &ctx.iter )) {
> +      regs_hash_destroy(ctx.regs_decl);
> +      regs_hash_destroy(ctx.regs_used);
> +      regs_hash_destroy(ctx.regs_ind_used);
>        return FALSE;
> +   }

Or just set ctx.errors = 1 and let it go through.

>  
>     regs_hash_destroy(ctx.regs_decl);
>     regs_hash_destroy(ctx.regs_used);
> --
> 2.7.4
> 
> 


More information about the mesa-dev mailing list