Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
fprintf(stderr,
"Failed to open device %s (%m)\n",
d->devnode);
- return false;
+ goto error;
}
rc = libevdev_new_from_fd(fd, &d->evdev);
"Failed to create context for %s (%s)\n",
d->devnode,
strerror(-rc));
- close(fd);
- return false;
+ goto error;
}
libevdev_set_clock_id(d->evdev, CLOCK_MONOTONIC);
ctx->ndevices++;
return true;
+error:
+ close(fd);
+ free(d);
+ return false;
+
}
static int
open_restricted(const char *path, int flags, void *user_data)