summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-01-14 16:48:19 -0800
committerEric Anholt <[email protected]>2011-01-14 16:55:35 -0800
commit25beab10cd39a400a0a6d2495cf814d22f346e81 (patch)
tree19d4ecc9ada383e7c113a865b26107288cbbdffa /src
parentd42acef139740a54fe571f99b62cba7720734d8c (diff)
ir_to_mesa: Fix segfaults on ir_to_mesa invocation after MSVC change.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index cb310231704..0929b959505 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);
}