dinput: Prevent a device interface leak when enumerating.

Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=36263
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 52aacd2377)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Rémi Bernon 2021-05-31 10:23:57 +02:00 committed by Michael Stefaniuc
parent e35da6ed01
commit 531247b84e
1 changed files with 6 additions and 0 deletions

View File

@ -1268,8 +1268,10 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP) if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
{ {
HeapFree(GetProcessHeap(), 0, didevis); HeapFree(GetProcessHeap(), 0, didevis);
IDirectInputDevice_Release(lpdid);
return DI_OK; return DI_OK;
} }
IDirectInputDevice_Release(lpdid);
} }
HeapFree(GetProcessHeap(), 0, didevis); HeapFree(GetProcessHeap(), 0, didevis);
@ -1287,7 +1289,11 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
IDirectInputDevice_GetDeviceInfo(lpdid, &didevi); IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP) if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
{
IDirectInputDevice_Release(lpdid);
return DI_OK; return DI_OK;
}
IDirectInputDevice_Release(lpdid);
} }
} }