From cf030ceef3f6eaa1b8752207393b50679b2ca857 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Fri, 30 Apr 2021 12:58:22 +0200 Subject: [PATCH] st/mesa: fix pipe resource leak When switching from a normal texture to a texture storage, unreference the old one to avoid leaking it. v2 (Emma): - Update commit message Reviewed-by: Emma Anholt Signed-off-by: Juan A. Suarez Romero Part-of: --- src/mesa/state_tracker/st_cb_texture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d220f1e3d08..3a4762d949a 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -3054,6 +3054,8 @@ st_texture_storage(struct gl_context *ctx, width, height, depth, &ptWidth, &ptHeight, &ptDepth, &ptLayers); + pipe_resource_reference(&stObj->pt, NULL); + if (smObj) { stObj->pt = st_texture_create_from_memory(st, smObj,