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

Nicolai Hähnle nhaehnle at gmail.com
Fri Feb 10 09:59:50 UTC 2017


On 10.02.2017 05:04, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This just fixes this without repeating the code.
>
> Reported-by: Li Qiang
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

> ---
>  src/gallium/auxiliary/tgsi/tgsi_sanity.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
> index f867925..239a2c9 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
> @@ -559,6 +559,7 @@ tgsi_sanity_check(
>     const struct tgsi_token *tokens )
>  {
>     struct sanity_check_ctx ctx;
> +   boolean retval;
>
>     ctx.iter.prolog = prolog;
>     ctx.iter.iterate_instruction = iter_instruction;
> @@ -580,11 +581,12 @@ tgsi_sanity_check(
>     ctx.implied_array_size = 0;
>     ctx.print = debug_get_option_print_sanity();
>
> -   if (!tgsi_iterate_shader( tokens, &ctx.iter ))
> -      return FALSE;
> -
> +   retval = 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);
> +   if (retval == FALSE)
> +      return FALSE;
> +
>     return ctx.errors == 0;
>  }
>



More information about the mesa-dev mailing list