Module: wine Branch: stable Commit: 531247b84e5f95ee565701f5c3f7fe85e543ecef URL: https://source.winehq.org/git/wine.git/?a=commit;h=531247b84e5f95ee565701f5c...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon May 31 10:23:57 2021 +0200
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 52aacd2377c68097ea165fdfff188fd6768fcc4c) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/dinput/dinput_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 5da60cf1f7c..17768df319a 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1268,8 +1268,10 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP) { HeapFree(GetProcessHeap(), 0, didevis); + IDirectInputDevice_Release(lpdid); return DI_OK; } + IDirectInputDevice_Release(lpdid); }
HeapFree(GetProcessHeap(), 0, didevis); @@ -1287,7 +1289,11 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP) + { + IDirectInputDevice_Release(lpdid); return DI_OK; + } + IDirectInputDevice_Release(lpdid); } }