Skip to content

Commit

Permalink
Fix /analyze warning (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Sep 27, 2024
1 parent 5b86313 commit 24df3a1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Src/ScreenGrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,14 @@ namespace
nullptr,
IID_GRAPHICS_PPV_ARGS(pStaging));
if (FAILED(hr))
{
if (*pStaging)
{
(*pStaging)->Release();
*pStaging = nullptr;
}
return hr;
}

SetDebugObjectName(*pStaging, L"ScreenGrab staging");

Expand Down Expand Up @@ -205,15 +212,23 @@ namespace

hr = commandList->Close();
if (FAILED(hr))
{
(*pStaging)->Release();
*pStaging = nullptr;
return hr;
}

// Execute the command list
pCommandQ->ExecuteCommandLists(1, CommandListCast(commandList.GetAddressOf()));

// Signal the fence
hr = pCommandQ->Signal(fence.Get(), 1);
if (FAILED(hr))
{
(*pStaging)->Release();
*pStaging = nullptr;
return hr;
}

// Block until the copy is complete
while (fence->GetCompletedValue() < 1)
Expand Down

0 comments on commit 24df3a1

Please sign in to comment.