[host] dxgi: fix possible null dereference

This commit is contained in:
Geoffrey McRae 2023-11-11 20:36:53 +11:00
parent 38b6b0ac40
commit 10e30eec57

View file

@ -388,8 +388,9 @@ static bool d3d12_preCopy(ID3D11Texture2D * src, unsigned textureIndex)
goto exit; goto exit;
} }
comRef_defineLocal(ID3D12Resource, d12src);
status = ID3D12Device_OpenSharedHandle(*this->device, status = ID3D12Device_OpenSharedHandle(*this->device,
handle, &IID_ID3D12Resource, (void **)&this->d12src); handle, &IID_ID3D12Resource, (void **)d12src);
CloseHandle(handle); CloseHandle(handle);
@ -404,7 +405,7 @@ static bool d3d12_preCopy(ID3D11Texture2D * src, unsigned textureIndex)
{ {
struct SharedCache *cache = &this->sharedCache[this->sharedCacheCount++]; struct SharedCache *cache = &this->sharedCache[this->sharedCacheCount++];
cache->tex = src; cache->tex = src;
*comRef_newGlobal(&cache->d12src) = (IUnknown *)this->d12src; comRef_toGlobal(cache->d12src, d12src);
} }
else else
{ {