From 84f465ec810bd3210010fb9633cd678881ca74f5 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Thu, 25 May 2023 16:15:28 +0200 Subject: [PATCH] mesa: fix refcnt imbalance related to _mesa_delete_semaphore_object() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák Part-of: --- 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