[PATCH 4/5] dinput: Free axis_map when joystick device is freed.
Rémi Bernon
rbernon at codeweavers.com
Mon May 31 03:23:58 CDT 2021
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=36263
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/dinput/joystick.c | 11 +++++++++++
dlls/dinput/joystick_linux.c | 2 +-
dlls/dinput/joystick_linuxinput.c | 2 +-
dlls/dinput/joystick_osx.c | 2 +-
dlls/dinput/joystick_private.h | 2 ++
5 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c
index a68c4df20e6..8ea7850621c 100644
--- a/dlls/dinput/joystick.c
+++ b/dlls/dinput/joystick.c
@@ -534,6 +534,17 @@ HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface,
return DI_OK;
}
+
+ULONG WINAPI JoystickWGenericImpl_Release(LPDIRECTINPUTDEVICE8W iface)
+{
+ JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
+ void *axis_map = This->axis_map;
+ ULONG res = IDirectInputDevice2WImpl_Release(iface);
+ if (!res) HeapFree(GetProcessHeap(), 0, axis_map);
+ return res;
+}
+
+
/******************************************************************************
* GetObjectInfo : get object info
*/
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index 5a88e643e07..3215978c995 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -786,7 +786,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
{
IDirectInputDevice2WImpl_QueryInterface,
IDirectInputDevice2WImpl_AddRef,
- IDirectInputDevice2WImpl_Release,
+ JoystickWGenericImpl_Release,
JoystickWGenericImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects,
JoystickLinuxWImpl_GetProperty,
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 488e9c04759..2b970271ec3 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -1231,7 +1231,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
{
IDirectInputDevice2WImpl_QueryInterface,
IDirectInputDevice2WImpl_AddRef,
- IDirectInputDevice2WImpl_Release,
+ JoystickWGenericImpl_Release,
JoystickWGenericImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects,
JoystickWImpl_GetProperty,
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
index 6d37a476380..27a47b07639 100644
--- a/dlls/dinput/joystick_osx.c
+++ b/dlls/dinput/joystick_osx.c
@@ -1484,7 +1484,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
{
IDirectInputDevice2WImpl_QueryInterface,
IDirectInputDevice2WImpl_AddRef,
- IDirectInputDevice2WImpl_Release,
+ JoystickWGenericImpl_Release,
JoystickWGenericImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects,
JoystickWImpl_GetProperty,
diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h
index 78d5d721808..874bf3e69a7 100644
--- a/dlls/dinput/joystick_private.h
+++ b/dlls/dinput/joystick_private.h
@@ -59,6 +59,8 @@ DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN;
BOOL device_disabled_registry(const char* name) DECLSPEC_HIDDEN;
+ULONG WINAPI JoystickWGenericImpl_Release(LPDIRECTINPUTDEVICE8W iface);
+
HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN;
--
2.31.0
More information about the wine-devel
mailing list