Skip to content

Commit

Permalink
Merge pull request #5 from der3318/release-resources
Browse files Browse the repository at this point in the history
Fix SetMuteGenshin(BOOL) Resources Leak
  • Loading branch information
tmarenko authored Jul 23, 2022
2 parents 4d00c5e + 99b85b6 commit c41f970
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,13 @@ HRESULT SetMuteGenshin(BOOL bMute) {
return hr;

hr = m_pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice);
m_pEnumerator->Release();
if (FAILED(hr))
return hr;

IAudioSessionManager2 *pasm = NULL;
hr = pDevice->Activate(__uuidof(IAudioSessionManager2), CLSCTX_ALL, NULL, (void **) &pasm);
pDevice->Release();
if (FAILED(hr))
return hr;

Expand Down Expand Up @@ -260,4 +262,4 @@ int main() {
DestroyTesseract();
system("pause");
return 1;
}
}

0 comments on commit c41f970

Please sign in to comment.