diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 0e427a3fa8d..f0bb52e7cb8 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -4610,9 +4610,14 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device1 *iface, if (FAILED(hr = d3d_query_create(device, (const D3D11_QUERY_DESC *)desc, FALSE, &object))) return hr; - *query = &object->ID3D10Query_iface; + if (query) + { + *query = &object->ID3D10Query_iface; + return S_OK; + } - return S_OK; + ID3D10Query_Release(&object->ID3D10Query_iface); + return S_FALSE; } static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device1 *iface,