r300: fix r300_destroy_context() related memory leaks

For instance, with "piglit/bin/fcc-blit-between-clears -auto -fbo"":
SUMMARY: AddressSanitizer: 70512 byte(s) leaked in 497 allocation(s).

Fixes: e01f86c67b ("r300: set PIPE_BIND_CONSTANT_BUFFER for const_uploader")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27791>
(cherry picked from commit b11ecacb9377240a81c24bc0eca3a110f9642bc3)
This commit is contained in:
Patrick Lerda 2024-02-23 23:47:51 +01:00 committed by Eric Engestrom
parent 046ca162a9
commit e94f1fc304
2 changed files with 7 additions and 1 deletions

View file

@ -1694,7 +1694,7 @@
"description": "r300: fix r300_destroy_context() related memory leaks",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e01f86c67b0bd955758366827cb8322aa1bec263",
"notes": null

View file

@ -93,6 +93,8 @@ static void r300_destroy_context(struct pipe_context* context)
u_upload_destroy(r300->uploader);
if (r300->context.stream_uploader)
u_upload_destroy(r300->context.stream_uploader);
if (r300->context.const_uploader)
u_upload_destroy(r300->context.const_uploader);
/* XXX: This function assumes r300->query_list was initialized */
r300_release_referenced_objects(r300);
@ -102,6 +104,7 @@ static void r300_destroy_context(struct pipe_context* context)
r300->rws->ctx_destroy(r300->ctx);
rc_destroy_regalloc_state(&r300->fs_regalloc_state);
rc_destroy_regalloc_state(&r300->vs_regalloc_state);
/* XXX: No way to tell if this was initialized or not? */
slab_destroy_child(&r300->pool_transfers);
@ -128,6 +131,9 @@ static void r300_destroy_context(struct pipe_context* context)
FREE(r300->vertex_stream_state.state);
}
}
FREE(r300->stencilref_fallback);
FREE(r300);
}