diff options
author | Icecream95 <[email protected]> | 2020-01-26 14:59:24 +1300 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-29 12:59:32 +0000 |
commit | 9be9fd85911883521a31111e728efc0f25b9bacd (patch) | |
tree | 7b9361e296e9e4d2f0ad7341272cf7f3100da8c5 /src/panfrost | |
parent | 6346490a2ee5535dc75fcab34981d2a5b591dc01 (diff) |
pan/midgard: Fix a liveness info leak
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3566>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3566>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/midgard/midgard_liveness.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/panfrost/midgard/midgard_liveness.c b/src/panfrost/midgard/midgard_liveness.c index b1b2f311ffa..fd93339ed94 100644 --- a/src/panfrost/midgard/midgard_liveness.c +++ b/src/panfrost/midgard/midgard_liveness.c @@ -92,7 +92,8 @@ liveness_block_update(compiler_context *ctx, midgard_block *blk) liveness_block_live_out(ctx, blk); - uint16_t *live = mem_dup(blk->live_out, ctx->temp_count * sizeof(uint16_t)); + uint16_t *live = ralloc_array(ctx, uint16_t, ctx->temp_count); + memcpy(live, blk->live_out, ctx->temp_count * sizeof(uint16_t)); mir_foreach_instr_in_block_rev(blk, ins) mir_liveness_ins_update(live, ins, ctx->temp_count); @@ -102,7 +103,7 @@ liveness_block_update(compiler_context *ctx, midgard_block *blk) for (unsigned i = 0; (i < ctx->temp_count) && !progress; ++i) progress |= (blk->live_in[i] != live[i]); - free(blk->live_in); + ralloc_free(blk->live_in); blk->live_in = live; return progress; @@ -131,8 +132,8 @@ mir_compute_liveness(compiler_context *ctx) /* Allocate */ mir_foreach_block(ctx, block) { - block->live_in = calloc(ctx->temp_count, sizeof(uint16_t)); - block->live_out = calloc(ctx->temp_count, sizeof(uint16_t)); + block->live_in = rzalloc_array(ctx, uint16_t, ctx->temp_count); + block->live_out = rzalloc_array(ctx, uint16_t, ctx->temp_count); } /* Initialize the work list with the exit block */ @@ -183,10 +184,10 @@ mir_invalidate_liveness(compiler_context *ctx) mir_foreach_block(ctx, block) { if (block->live_in) - free(block->live_in); + ralloc_free(block->live_in); if (block->live_out) - free(block->live_out); + ralloc_free(block->live_out); block->live_in = NULL; block->live_out = NULL; |