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 <emma@anholt.net>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10643>
This commit is contained in:
Juan A. Suarez Romero
2021-04-30 12:58:22 +02:00
committed by Marge Bot
parent 66bf683ca9
commit cf030ceef3
+2
View File
@@ -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,