From 531247b84e5f95ee565701f5c3f7fe85e543ecef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 31 May 2021 10:23:57 +0200 Subject: [PATCH] dinput: Prevent a device interface leak when enumerating. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=36263 Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard (cherry picked from commit 52aacd2377c68097ea165fdfff188fd6768fcc4c) Signed-off-by: Michael Stefaniuc --- 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); } }