diff options
author | Marek Olšák <[email protected]> | 2015-01-27 14:52:37 +0000 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2015-01-28 21:03:46 +0000 |
commit | 5935edd47c3b2a7a3047da5ad03c4d82e082628b (patch) | |
tree | 0363957cb5be8ec4b0eb1f04c0d79e51b6887ffb /src/gallium/drivers/radeonsi/si_pm4.c | |
parent | bb26ebac134ad97effad46eede1a14334c0fb675 (diff) |
radeonsi: Avoid leaking memory when rebuilding shader states
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pm4.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pm4.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pm4.c b/src/gallium/drivers/radeonsi/si_pm4.c index 5edf15218f6..e9b9a5f556a 100644 --- a/src/gallium/drivers/radeonsi/si_pm4.c +++ b/src/gallium/drivers/radeonsi/si_pm4.c @@ -103,6 +103,13 @@ void si_pm4_add_bo(struct si_pm4_state *state, state->bo_priority[idx] = priority; } +void si_pm4_free_state_simple(struct si_pm4_state *state) +{ + for (int i = 0; i < state->nbo; ++i) + r600_resource_reference(&state->bo[i], NULL); + FREE(state); +} + void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsigned idx) @@ -114,10 +121,7 @@ void si_pm4_free_state(struct si_context *sctx, sctx->emitted.array[idx] = NULL; } - for (int i = 0; i < state->nbo; ++i) { - r600_resource_reference(&state->bo[i], NULL); - } - FREE(state); + si_pm4_free_state_simple(state); } unsigned si_pm4_dirty_dw(struct si_context *sctx) |