heap corruption?
This commit is contained in:
parent
dc06046f7c
commit
55125bb3ce
3 changed files with 8 additions and 6 deletions
10
dev_evdev.c
10
dev_evdev.c
|
|
@ -56,7 +56,7 @@ void dev_evdev_close(struct libevdev* out_evdev) {
|
|||
|
||||
int dev_evdev_open(
|
||||
const uinput_filters_t *const in_filters,
|
||||
struct libevdev* out_evdev
|
||||
struct libevdev* *const out_evdev
|
||||
) {
|
||||
int res = -ENOENT;
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ int dev_evdev_open(
|
|||
open_fds[open_sysfs_idx] = fd;
|
||||
}
|
||||
|
||||
if (libevdev_new_from_fd(fd, &out_evdev) != 0) {
|
||||
if (libevdev_new_from_fd(fd, out_evdev) != 0) {
|
||||
fprintf(stderr, "Cannot initialize libevdev from this device (%s) -- Skipping.\n", path);
|
||||
open_fds[open_sysfs_idx] = -1;
|
||||
close(fd);
|
||||
|
|
@ -122,11 +122,13 @@ int dev_evdev_open(
|
|||
}
|
||||
|
||||
// try to open the device
|
||||
if (!ev_matches(out_evdev, in_filters)) {
|
||||
libevdev_free(out_evdev);
|
||||
if (!ev_matches(*out_evdev, in_filters)) {
|
||||
libevdev_free(*out_evdev);
|
||||
open_fds[open_sysfs_idx] = -1;
|
||||
close(fd);
|
||||
continue;
|
||||
} else {
|
||||
printf("post-ev_matches: %s\n", libevdev_get_name(*out_evdev));
|
||||
}
|
||||
|
||||
// the device has been found
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
int dev_evdev_open(
|
||||
const uinput_filters_t *const in_filters,
|
||||
struct libevdev* out_evdev
|
||||
struct libevdev* *const out_evdev
|
||||
);
|
||||
|
||||
void dev_evdev_close(struct libevdev* out_evdev);
|
||||
|
|
|
|||
2
dev_in.c
2
dev_in.c
|
|
@ -100,7 +100,7 @@ int open_device(
|
|||
const uinput_filters_t *const in_filters,
|
||||
dev_in_ev_t *const out_dev
|
||||
) {
|
||||
int res = dev_evdev_open(in_filters, out_dev->evdev);
|
||||
int res = dev_evdev_open(in_filters, &out_dev->evdev);
|
||||
if (res != 0) {
|
||||
fprintf(stderr, "Unable to open the specified device: %d\n", res);
|
||||
goto open_device_err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue