Rémi Bernon : dinput: Free axis_map when joystick device is freed.
Alexandre Julliard
julliard at winehq.org
Mon May 31 15:58:36 CDT 2021
Module: wine
Branch: master
Commit: 5cf67f00d0e4d157fb08ac56cb9d8066c57a7be2
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5cf67f00d0e4d157fb08ac56cb9d8066c57a7be2
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon May 31 10:23:58 2021 +0200
dinput: Free axis_map when joystick device is freed.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=36263
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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;
More information about the wine-cvs
mailing list