venus: Fix leak in syncobj creation failure path

CID: 1475984 Resource leak
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35474>
This commit is contained in:
Corentin Noël
2025-06-12 14:37:17 +02:00
committed by Marge Bot
parent 6469d7268f
commit c0d1b199ae
+4
View File
@@ -158,6 +158,8 @@ sim_syncobj_create(struct virtgpu *gpu, bool signaled)
sim.syncobjs = _mesa_pointer_hash_table_create(NULL);
if (!sim.syncobjs) {
mtx_unlock(&sim.mutex);
mtx_destroy(&syncobj->mutex);
free(syncobj);
return 0;
}
@@ -172,6 +174,8 @@ sim_syncobj_create(struct virtgpu *gpu, bool signaled)
_mesa_hash_table_destroy(sim.syncobjs, NULL);
sim.syncobjs = NULL;
mtx_unlock(&sim.mutex);
mtx_destroy(&syncobj->mutex);
free(syncobj);
return 0;
}