From 25beab10cd39a400a0a6d2495cf814d22f346e81 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 14 Jan 2011 16:48:19 -0800 Subject: [PATCH] ir_to_mesa: Fix segfaults on ir_to_mesa invocation after MSVC change. --- src/mesa/program/ir_to_mesa.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index cb31023..0929b95 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2641,9 +2641,9 @@ set_uniform_initializers(struct gl_context *ctx, void ir_to_mesa_visitor::copy_propagate(void) { - ir_to_mesa_instruction **acp = new ir_to_mesa_instruction *[this->next_temp * 4]; - - memset(acp, 0, sizeof(acp) * this->next_temp * 4); + ir_to_mesa_instruction **acp = talloc_zero_array(mem_ctx, + ir_to_mesa_instruction *, + this->next_temp * 4); foreach_iter(exec_list_iterator, iter, this->instructions) { ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); @@ -2706,7 +2706,7 @@ ir_to_mesa_visitor::copy_propagate(void) case OPCODE_ELSE: case OPCODE_ENDIF: /* End of a basic block, clear the ACP entirely. */ - memset(&acp, 0, sizeof(acp)); + memset(acp, 0, sizeof(*acp) * this->next_temp * 4); break; default: @@ -2715,7 +2715,7 @@ ir_to_mesa_visitor::copy_propagate(void) */ if (inst->dst_reg.file == PROGRAM_TEMPORARY) { if (inst->dst_reg.reladdr) { - memset(&acp, 0, sizeof(acp)); + memset(acp, 0, sizeof(*acp) * this->next_temp * 4); } else { for (int i = 0; i < 4; i++) { if (inst->dst_reg.writemask & (1 << i)) { @@ -2742,7 +2742,7 @@ ir_to_mesa_visitor::copy_propagate(void) } } - delete [] acp; + talloc_free(acp); } -- 2.7.4