Module: wine Branch: master Commit: b5ed53899337660c3fad7bd4023b84eb84eb96f7 URL: https://gitlab.winehq.org/wine/wine/-/commit/b5ed53899337660c3fad7bd4023b84e...
Author: Rémi Bernon rbernon@codeweavers.com Date: Fri Aug 5 15:49:17 2022 +0200
win32u: Avoid reallocating rawinput device array with zero size.
It actually frees the pointer.
---
dlls/win32u/rawinput.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index 8e3f3ace15a..44951522442 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -856,6 +856,12 @@ BOOL WINAPI NtUserRegisterRawInputDevices( const RAWINPUTDEVICE *devices, UINT d
pthread_mutex_lock( &rawinput_mutex );
+ if (!registered_device_count && !device_count) + { + pthread_mutex_unlock( &rawinput_mutex ); + return TRUE; + } + size = (SIZE_T)device_size * (registered_device_count + device_count); registered_devices = realloc( registered_devices, size ); if (registered_devices) for (i = 0; i < device_count; ++i) register_rawinput_device( devices + i );