mesa: fix old classic drivers to use ralloc for ARB asm programs
authorTimothy Arceri <timothy.arceri@collabora.com>
Fri, 18 Nov 2016 00:51:59 +0000 (11:51 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Fri, 18 Nov 2016 12:39:40 +0000 (23:39 +1100)
These changes were missed in 0ad69e6b5.

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98767

src/mesa/program/arbprogparse.c
src/mesa/program/ir_to_mesa.cpp

index 196d30f4dafab295caa3d2a09008ad7c4165b306..9b843f628c1d5b6621146b07d748840e2be06e3d 100644 (file)
@@ -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)
index c42c19b41106018279e1c7c9ea1ac71a262705c3..b042c86f9390c7b77201d219eab7b8c30318370a 100644 (file)
@@ -2814,9 +2814,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);
 
@@ -2948,7 +2947,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;
 }