radv: fix double free corruption in radv_alloc_memory()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 22 Jan 2020 07:40:11 +0000 (08:40 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jan 2020 17:01:16 +0000 (17:01 +0000)
If the driver fails to allocate memory for some reasons, it shouldn't
free the 'mem' object twice.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2302
Fixes: 825ddfee599 ("radv: Handle device memory alloc failure with normal free.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3508>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3508>

src/amd/vulkan/radv_device.c

index c3ff31668aa7716caa5eaa0162d516f2b526b3d9..2b222d331a31c7ac3ba8211fbbee72e2fda6df6d 100644 (file)
@@ -5063,7 +5063,6 @@ static VkResult radv_alloc_memory(struct radv_device *device,
 
 fail:
        radv_free_memory(device, pAllocator,mem);
-       vk_free2(&device->alloc, pAllocator, mem);
 
        return result;
 }