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

Author: Patrick Lerda <[email protected]>
Date:   Thu May 25 16:15:28 2023 +0200

mesa: fix refcnt imbalance related to _mesa_delete_semaphore_object()

Indeed, the fence reference was not freed.

For instance, this issue is triggered with
"piglit/bin/ext_external_objects-vk-semaphores-2 -auto -fbo"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

Fixes: 7b6cd912a59a ("mesa/st: get rid of ST_CALLOC_STRUCT use CALLOC_STRUCT")
Signed-off-by: Patrick Lerda <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23296>

---

 src/mesa/main/externalobjects.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index ed3f7cd07a3..5dac6d558b5 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -754,8 +754,11 @@ void
 _mesa_delete_semaphore_object(struct gl_context *ctx,
                               struct gl_semaphore_object *semObj)
 {
-   if (semObj != &DummySemaphoreObject)
+   if (semObj != &DummySemaphoreObject) {
+      struct pipe_context *pipe = ctx->pipe;
+      pipe->screen->fence_reference(ctx->screen, &semObj->fence, NULL);
       FREE(semObj);
+   }
 }
 
 void GLAPIENTRY

Reply via email to