vkd3d: Set pointer to NULL if heap creation fails.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-09-12 15:19:58 +02:00 committed by Alexandre Julliard
parent 150d1f0eb8
commit 605cb12eca
2 changed files with 6 additions and 0 deletions

View File

@ -1946,7 +1946,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device *iface,
iface, desc, debugstr_guid(iid), heap);
if (FAILED(hr = d3d12_heap_create(device, desc, &object)))
{
*heap = NULL;
return hr;
}
return return_interface(&object->ID3D12Heap_iface, &IID_ID3D12Heap, iid, heap);
}

View File

@ -1854,9 +1854,12 @@ static void test_create_heap(void)
desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES | D3D12_HEAP_FLAG_ALLOW_DISPLAY;
hr = ID3D12Device_CreateHeap(device, &desc, &IID_ID3D12Heap, (void **)&heap);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
heap = (void *)0xdeadbeef;
desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_ALLOW_DISPLAY;
hr = ID3D12Device_CreateHeap(device, &desc, &IID_ID3D12Heap, (void **)&heap);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
ok(!heap, "Got unexpected pointer %p.\n", heap);
for (i = 0; i < ARRAY_SIZE(tests); ++i)
{