Rémi Bernon (@rbernon) commented about dlls/dinput/joystick_hid.c:
+static struct joystick_device *joystick_devices; +static unsigned int joystick_device_count;
+static unsigned int get_joystick_index( const WCHAR *device_path ) +{
- unsigned int i;
- EnterCriticalSection( &joystick_devices_crit );
- for (i = 0; i < joystick_device_count; ++i)
if (!wcsicmp( joystick_devices[i].device_path, device_path )) break;
- if (i == joystick_device_count)
- {
++joystick_device_count;
joystick_devices = realloc( joystick_devices, sizeof(*joystick_devices) * joystick_device_count );
Allocation errors need to be handled here.