Check that memory allocation succeeded before mapping memory

* This fixes a potential crash if we allocate memory then map it immediately
  without checking
This commit is contained in:
baldurk
2022-12-22 16:21:54 +00:00
parent 2697a2add8
commit 707edac523
+6
View File
@@ -302,6 +302,12 @@ void *GPUBuffer::Map(uint32_t *bindoffset, VkDeviceSize usedsize)
mapoffset = offset;
if(mem == VK_NULL_HANDLE)
{
RDCERR("Manually reporting failed memory map with no memory");
m_pDriver->CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
}
void *ptr = NULL;
VkResult vkr = m_pDriver->vkMapMemory(device, mem, offset, size, 0, (void **)&ptr);
m_pDriver->CheckVkResult(vkr);