aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2020-07-10 17:14:30 +0200
committerSamuel Pitoiset <[email protected]>2020-07-15 13:53:29 +0200
commitce7a7aeeccf44fa00fd8157b5e592c4980852f3b (patch)
treef0aa2a230e7f5a38a4fb29395120f41652d4747e /src
parent8ef52974cdbd2995dc3aee1d7a705e7e5e2e83d8 (diff)
radv: destroy the base object if VkCreateEvent() failed
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5868>
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/radv_device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index f449199d994..6594b2a00d9 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -5800,7 +5800,9 @@ static void radv_destroy_event(struct radv_device *device,
const VkAllocationCallbacks* pAllocator,
struct radv_event *event)
{
- device->ws->buffer_destroy(event->bo);
+ if (event->bo)
+ device->ws->buffer_destroy(event->bo);
+
vk_object_base_finish(&event->base);
vk_free2(&device->vk.alloc, pAllocator, event);
}
@@ -5826,7 +5828,7 @@ VkResult radv_CreateEvent(
RADEON_FLAG_VA_UNCACHED | RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING,
RADV_BO_PRIORITY_FENCE);
if (!event->bo) {
- vk_free2(&device->vk.alloc, pAllocator, event);
+ radv_destroy_event(device, pAllocator, event);
return vk_error(device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
}