radv/winsys: Fix memory leak.
authorVinson Lee <vlee@freedesktop.org>
Mon, 31 Aug 2020 00:52:32 +0000 (17:52 -0700)
committerVinson Lee <vlee@freedesktop.org>
Tue, 1 Sep 2020 00:33:51 +0000 (17:33 -0700)
Fix warning reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable handles going out of scope leaks the storage it
points to.

Fixes 485ea7d711fc ("radv/winsys: pass the buffer list via the CS ioctl for less CPU overhead")

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6510>

src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 79e5d8daa6d8d9a73059dfaa58eebc62dfb33014..6d5478e9d2ab28f244d58fd926b9e972e18186be 100644 (file)
@@ -999,7 +999,7 @@ radv_amdgpu_winsys_cs_submit_fallback(struct radeon_winsys_ctx *_ctx,
 
        ibs = malloc(number_of_ibs * sizeof(*ibs));
        if (!ibs) {
-               free(request.handles);
+               free(handles);
                return VK_ERROR_OUT_OF_HOST_MEMORY;
        }