winsys/amdgpu: fix memory leaks when amdgpu_cs_create fails

amdgpu_cs_destroy must execute with non-NULL.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41429>
This commit is contained in:
Marek Olšák 2026-05-07 16:14:04 -04:00 committed by Marge Bot
parent d999e36eda
commit e471e83a65

View file

@ -916,8 +916,7 @@ static void amdgpu_cs_destroy(struct radeon_cmdbuf *rcs)
{
struct amdgpu_cs *acs = amdgpu_cs(rcs);
if (!acs)
return;
assert(acs);
amdgpu_cs_sync_flush(rcs);
util_queue_fence_destroy(&acs->flush_completed);
@ -1018,8 +1017,8 @@ amdgpu_cs_create(struct radeon_cmdbuf *rcs,
return true;
fail:
rcs->priv = NULL;
amdgpu_cs_destroy(rcs);
rcs->priv = NULL;
return false;
}