[Mesa-dev] [PATCH] mesa: fix old classic drivers to use ralloc for ARB asm programs

Kenneth Graunke kenneth at whitecape.org
Fri Nov 18 06:37:53 UTC 2016


On Friday, November 18, 2016 11:51:59 AM PST Timothy Arceri wrote:
> These changes were missed in 0ad69e6b5.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98767
> ---
>  src/mesa/program/arbprogparse.c | 4 ++--
>  src/mesa/program/ir_to_mesa.cpp | 7 +++----
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
> index 196d30f..9b843f6 100644
> --- a/src/mesa/program/arbprogparse.c
> +++ b/src/mesa/program/arbprogparse.c
> @@ -85,7 +85,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
>        return;
>     }
>  
> -   free(program->String);
> +   ralloc_free(program->String);
>  
>     /* Copy the relevant contents of the arb_program struct into the
>      * fragment_program struct.
> @@ -121,7 +121,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
>  
>     program->info.fs.uses_discard = state.fragment.UsesKill;
>  
> -   free(program->arb.Instructions);
> +   ralloc_free(program->arb.Instructions);
>     program->arb.Instructions = prog.arb.Instructions;
>  
>     if (program->Parameters)
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index 584565f..88a7f36 100644
> --- a/src/mesa/program/ir_to_mesa.cpp
> +++ b/src/mesa/program/ir_to_mesa.cpp
> @@ -2812,9 +2812,8 @@ get_mesa_program(struct gl_context *ctx,
>  
>     unsigned num_instructions = v.instructions.length();
>  
> -   mesa_instructions =
> -      (struct prog_instruction *)calloc(num_instructions,
> -					sizeof(*mesa_instructions));
> +   mesa_instructions = rzalloc_array(prog, struct prog_instruction,
> +                                     num_instructions);
>     mesa_instruction_annotation = ralloc_array(v.mem_ctx, ir_instruction *,
>  					      num_instructions);
>  
> @@ -2944,7 +2943,7 @@ get_mesa_program(struct gl_context *ctx,
>     return prog;
>  
>  fail_exit:
> -   free(mesa_instructions);
> +   ralloc_free(mesa_instructions);
>     _mesa_reference_program(ctx, &shader->Program, NULL);
>     return NULL;
>  }
> 

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161117/65b8d7fb/attachment.sig>


More information about the mesa-dev mailing list