Rémi Bernon : server: Avoid reallocating rawinput device array with zero size.

Alexandre Julliard julliard at winehq.org
Mon Aug 8 15:17:51 CDT 2022


Module: wine
Branch: master
Commit: 28aa321f3696f0713e7ddecda66783e76b933ab9
URL:    https://gitlab.winehq.org/wine/wine/-/commit/28aa321f3696f0713e7ddecda66783e76b933ab9

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Aug  5 15:46:05 2022 +0200

server: Avoid reallocating rawinput device array with zero size.

It actually frees the pointer.

---

 server/queue.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server/queue.c b/server/queue.c
index d98d645065f..01fe8d6c060 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -3380,6 +3380,14 @@ DECL_HANDLER(update_rawinput_devices)
     size_t size = device_count * sizeof(*devices);
     struct process *process = current->process;
 
+    if (!size)
+    {
+        process->rawinput_device_count = 0;
+        process->rawinput_mouse = NULL;
+        process->rawinput_kbd = NULL;
+        return;
+    }
+
     if (!(tmp = realloc( process->rawinput_devices, size )))
     {
         set_error( STATUS_NO_MEMORY );




More information about the wine-cvs mailing list