From f467ebadd6140a360dd191ea496dbd978d94b00e Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 31 Jan 2022 17:08:09 +0300 Subject: [PATCH] d3d11: Always initialize out view pointer in CreateUnorderedAccessView(). Signed-off-by: Nikolay Sivov Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/device.c | 2 ++ dlls/d3d11/tests/d3d11.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 858cd9f6d4a..7e5acc11824 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3399,6 +3399,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateUnorderedAccessView(ID3D11De TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view); + *view = NULL; + if (FAILED(hr = d3d11_unordered_access_view_create(device, resource, desc, &object))) return hr; diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 1db367f39fa..ec385a92f50 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -19433,8 +19433,10 @@ static void test_create_unordered_access_view(void) U(uav_desc).Buffer.NumElements = 64; U(uav_desc).Buffer.Flags = 0; + uav = (void *)0xdeadbeef; hr = ID3D11Device_CreateUnorderedAccessView(device, (ID3D11Resource *)buffer, NULL, &uav); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!uav, "Unexpected pointer %p.\n", uav); expected_refcount = get_refcount(device) + 1; hr = ID3D11Device_CreateUnorderedAccessView(device, (ID3D11Resource *)buffer, &uav_desc, &uav); @@ -19483,8 +19485,10 @@ static void test_create_unordered_access_view(void) U(uav_desc).Buffer.NumElements = 64; U(uav_desc).Buffer.Flags = 0; + uav = (void *)0xdeadbeef; hr = ID3D11Device_CreateUnorderedAccessView(device, (ID3D11Resource *)buffer, &uav_desc, &uav); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!uav, "Unexpected pointer %p.\n", uav); ID3D11Buffer_Release(buffer); @@ -19579,9 +19583,11 @@ static void test_create_unordered_access_view(void) texture = (ID3D11Resource *)texture3d; } + uav = (void *)0xdeadbeef; get_uav_desc(&uav_desc, &invalid_desc_tests[i].uav_desc); hr = ID3D11Device_CreateUnorderedAccessView(device, texture, &uav_desc, &uav); ok(hr == E_INVALIDARG, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(!uav, "Unexpected pointer %p.\n", uav); ID3D11Resource_Release(texture); }