Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/wscons.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down