mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user