From fefc1e57d22666867852542d4e70cc535992d84e Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Bernon?= Date: Sat, 13 May 2023 13:21:31 +0200 Subject: [PATCH] dinput/tests: Avoid leaking a IDirectInput reference (Valgrind). --- dlls/dinput/tests/device8.c | 1 + dlls/dinput/tests/force_feedback.c | 8 +++++++- dlls/dinput/tests/joystick8.c | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index 71982f8f622..69106749528 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -429,6 +429,7 @@ void test_overlapped_format( DWORD version ) cleanup: IUnknown_Release( keyboard ); + IDirectInput_Release( dinput ); DestroyWindow( hwnd ); CloseHandle( event ); diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index 0086144fb73..c20125655f4 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -213,7 +213,7 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst ) { IDirectInput8W *di8; IDirectInputW *di; - ULONG count; + ULONG count, ref; HRESULT hr; if (version >= 0x800) @@ -270,6 +270,9 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst ) if ((devinst->dwDevType & 0xff) != DI8DEVTYPE_SUPPLEMENTAL) ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr ); else ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr ); ok( count == 0, "got count %lu, expected 0\n", count ); + + ref = IDirectInput8_Release( di8 ); + ok( ref == 0, "Release returned %ld\n", ref ); } else { @@ -324,6 +327,9 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst ) hr = IDirectInput_EnumDevices( di, 0x14, enum_device_count, &count, DIEDFL_ALLDEVICES ); ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr ); + + ref = IDirectInput_Release( di ); + ok( ref == 0, "Release returned %ld\n", ref ); } } diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index b6a627d6d25..60bee06479a 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -349,6 +349,8 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst ) ref = IDirectInputDevice8_Release( device ); ok( ref == 0, "Release returned %ld\n", ref ); + ref = IDirectInput8_Release( di8 ); + ok( ref == 0, "Release returned %ld\n", ref ); } else { @@ -403,6 +405,8 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst ) hr = IDirectInput_EnumDevices( di, 0x14, enum_device_count, &count, DIEDFL_ALLDEVICES ); ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr ); + ref = IDirectInput_Release( di ); + ok( ref == 0, "Release returned %ld\n", ref ); } } -- 2.11.4.GIT