From 10e30eec5746848f85348768211831188869d421 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 11 Nov 2023 20:36:53 +1100 Subject: [PATCH] [host] dxgi: fix possible null dereference --- host/platform/Windows/capture/DXGI/src/d3d12.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/host/platform/Windows/capture/DXGI/src/d3d12.c b/host/platform/Windows/capture/DXGI/src/d3d12.c index bdb9f939..d4d85cef 100644 --- a/host/platform/Windows/capture/DXGI/src/d3d12.c +++ b/host/platform/Windows/capture/DXGI/src/d3d12.c @@ -388,8 +388,9 @@ static bool d3d12_preCopy(ID3D11Texture2D * src, unsigned textureIndex) goto exit; } + comRef_defineLocal(ID3D12Resource, d12src); status = ID3D12Device_OpenSharedHandle(*this->device, - handle, &IID_ID3D12Resource, (void **)&this->d12src); + handle, &IID_ID3D12Resource, (void **)d12src); CloseHandle(handle); @@ -404,7 +405,7 @@ static bool d3d12_preCopy(ID3D11Texture2D * src, unsigned textureIndex) { struct SharedCache *cache = &this->sharedCache[this->sharedCacheCount++]; cache->tex = src; - *comRef_newGlobal(&cache->d12src) = (IUnknown *)this->d12src; + comRef_toGlobal(cache->d12src, d12src); } else {