dinput joystick offsets array bug fix
Robert Reif
reif at earthlink.net
Wed Sep 8 20:57:53 CDT 2004
This fixes a heap corruption problem.
offsets array is the size of the wine data format so there is no need to
reallocate it when the format changes.
-------------- next part --------------
Index: dlls/dinput/joystick_linux.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick_linux.c,v
retrieving revision 1.12
diff -u -r1.12 joystick_linux.c
--- dlls/dinput/joystick_linux.c 8 Sep 2004 21:48:33 -0000 1.12
+++ dlls/dinput/joystick_linux.c 9 Sep 2004 01:52:51 -0000
@@ -685,7 +685,6 @@
LPDIDATAFORMAT new_df = 0;
LPDIOBJECTDATAFORMAT new_rgodf = 0;
ObjProps * new_props = 0;
- int * new_offsets = 0;
TRACE("(%p,%p)\n",This,df);
@@ -710,14 +709,9 @@
if (new_props == 0)
goto FAILED;
- new_offsets = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*sizeof(int));
- if (new_offsets == 0)
- goto FAILED;
-
HeapFree(GetProcessHeap(),0,This->user_df);
HeapFree(GetProcessHeap(),0,This->user_df->rgodf);
HeapFree(GetProcessHeap(),0,This->props);
- HeapFree(GetProcessHeap(),0,This->offsets);
release_DataFormat(This->transform);
This->user_df = new_df;
@@ -731,7 +725,6 @@
This->props[i].lDeadZone = 1000;
This->props[i].lSaturation = 0;
}
- This->offsets = new_offsets;
This->transform = create_DataFormat(&c_dfDIJoystick2, This->user_df, This->offsets);
calculate_ids(This);
@@ -740,8 +733,6 @@
FAILED:
WARN("out of memory\n");
- if (new_offsets)
- HeapFree(GetProcessHeap(),0,new_offsets);
if (new_props)
HeapFree(GetProcessHeap(),0,new_props);
if (new_rgodf)
More information about the wine-patches
mailing list