Module: Mesa
Branch: main
Commit: 83cd7d23a26d3cbd1af4805e95c4e588950f0fd5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83cd7d23a26d3cbd1af4805e95c4e588950f0fd5

Author: Patrick Lerda <[email protected]>
Date:   Mon May  8 18:02:44 2023 +0200

mesa: fix refcnt imbalance related to egl_image_target_texture()

Indeed, the locally allocated "stimg" reference was not freed
on a specific code path.

For instance, this issue is triggered on radeonsi or r600 with:
"piglit/bin/egl-ext_egl_image_storage -auto -fbo"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

Fixes: 6a3f5c65128b ("mesa: simplify st_egl_image binding process for texture 
storage")
Signed-off-by: Patrick Lerda <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23165>

---

 src/mesa/main/teximage.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 53b1e368fd1..1a9db071294 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3564,6 +3564,7 @@ egl_image_target_texture(struct gl_context *ctx,
              !(target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES)) {
             _mesa_error(ctx, GL_INVALID_OPERATION,
                         "%s(texture is imported from dmabuf)", caller);
+            pipe_resource_reference(&stimg.texture, NULL);
             _mesa_unlock_texture(ctx, texObj);
             return;
          }

Reply via email to