radv: fix double free corruption in radv_alloc_memory()

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: 825ddfee59 ("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>
This commit is contained in:
Samuel Pitoiset
2020-01-22 08:40:11 +01:00
committed by Marge Bot
parent 5a6a88f58c
commit bd51538d28

View 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;
}