vkd3d: Destroy GLOBAL_BUFFER for some early error out paths.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2021-08-30 13:36:33 +02:00
parent 69d4f55219
commit 426cdc9218
1 changed files with 6 additions and 0 deletions

View File

@ -430,7 +430,10 @@ static HRESULT vkd3d_memory_allocation_init(struct vkd3d_memory_allocation *allo
allocation->flags |= VKD3D_ALLOCATION_FLAG_ALLOW_WRITE_WATCH;
if (!(host_ptr = vkd3d_allocate_write_watch_pointer(&info->heap_properties, memory_requirements.size)))
{
VK_CALL(vkDestroyBuffer(device->vk_device, allocation->resource.vk_buffer, NULL));
return E_INVALIDARG;
}
}
if (host_ptr)
@ -445,7 +448,10 @@ static HRESULT vkd3d_memory_allocation_init(struct vkd3d_memory_allocation *allo
}
if (FAILED(hr))
{
VK_CALL(vkDestroyBuffer(device->vk_device, allocation->resource.vk_buffer, NULL));
return hr;
}
/* Map memory if the allocation was requested to be host-visible,
* but do not map if the allocation was meant to be device-local