Ivo Ivanov : winebus.sys: Fix memory leaks in bus_event_queue functions.
Alexandre Julliard
julliard at winehq.org
Fri Oct 8 14:12:26 CDT 2021
Module: wine
Branch: master
Commit: 8f37de5149e2440c7da831c083ac54bdbd166b83
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8f37de5149e2440c7da831c083ac54bdbd166b83
Author: Ivo Ivanov <logos128 at gmail.com>
Date: Fri Oct 8 12:36:44 2021 +0200
winebus.sys: Fix memory leaks in bus_event_queue functions.
Signed-off-by: Ivo Ivanov <logos128 at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winebus.sys/unixlib.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c
index ea26094049e..f66fd78d176 100644
--- a/dlls/winebus.sys/unixlib.c
+++ b/dlls/winebus.sys/unixlib.c
@@ -329,7 +329,11 @@ BOOL bus_event_queue_device_removed(struct list *queue, struct unix_device *devi
struct bus_event *event = malloc(size);
if (!event) return FALSE;
- if (unix_device_incref(device) == 1) return FALSE; /* being destroyed */
+ if (unix_device_incref(device) == 1) /* being destroyed */
+ {
+ free(event);
+ return FALSE;
+ }
event->type = BUS_EVENT_TYPE_DEVICE_REMOVED;
event->device = device;
@@ -344,7 +348,11 @@ BOOL bus_event_queue_device_created(struct list *queue, struct unix_device *devi
struct bus_event *event = malloc(size);
if (!event) return FALSE;
- if (unix_device_incref(device) == 1) return FALSE; /* being destroyed */
+ if (unix_device_incref(device) == 1) /* being destroyed */
+ {
+ free(event);
+ return FALSE;
+ }
event->type = BUS_EVENT_TYPE_DEVICE_CREATED;
event->device = device;
@@ -360,7 +368,11 @@ BOOL bus_event_queue_input_report(struct list *queue, struct unix_device *device
struct bus_event *event = malloc(size);
if (!event) return FALSE;
- if (unix_device_incref(device) == 1) return FALSE; /* being destroyed */
+ if (unix_device_incref(device) == 1) /* being destroyed */
+ {
+ free(event);
+ return FALSE;
+ }
event->type = BUS_EVENT_TYPE_INPUT_REPORT;
event->device = device;
More information about the wine-cvs
mailing list