From 8275e49e689c900705b1f2458f0a2c01a0fcd4be Mon Sep 17 00:00:00 2001 From: kikadf Date: Fri, 30 Jan 2026 11:16:16 +0100 Subject: [PATCH 1/2] wscons_device_dispatch: fix size passed to read() --- src/wscons.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wscons.c b/src/wscons.c index 2120f073..b3c3fdd0 100644 --- a/src/wscons.c +++ b/src/wscons.c @@ -239,7 +239,7 @@ wscons_device_dispatch(void *data) ssize_t len; int count, i; - len = read(device->fd, wsevents, sizeof(struct wscons_event)); + len = read(device->fd, wsevents, sizeof(wsevents)); if (len <= 0 || (len % sizeof(struct wscons_event)) != 0) return; From 16805d32720cbd93666606de2f161c6ab0437b93 Mon Sep 17 00:00:00 2001 From: kikadf Date: Fri, 30 Jan 2026 11:24:00 +0100 Subject: [PATCH 2/2] libinput_path_add_device: clean up device resources on error --- src/wscons.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/wscons.c b/src/wscons.c index b3c3fdd0..9013c3bd 100644 --- a/src/wscons.c +++ b/src/wscons.c @@ -576,8 +576,18 @@ libinput_path_add_device(struct libinput *libinput, return device; err: - if (device != NULL) - close_restricted(libinput, device->fd); + if (device != NULL) { + if (device->source) + libinput_remove_source(libinput, device->source); + if (device->devname) { + free(device->devname); + device->devname = NULL; + } + if (device->fd >= 0) + close_restricted(libinput, device->fd); + } else if (fd >= 0) { + close_restricted(libinput, fd); + } free(wscons_device); return NULL; }