[PATCH libevdev] Ignore NULL as argument in libevdev_uinput_destroy()
Peter Hutterer
peter.hutterer at who-t.net
Thu May 1 14:56:40 PDT 2014
Triggered by the tests when run as non-root. Simply ignore any attempt to
destroy a NULL device, which also matches the behaviour of libevdev_free().
Reported-by: Andreas Radke <a.radke at arcor.de>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
libevdev/libevdev-uinput.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libevdev/libevdev-uinput.c b/libevdev/libevdev-uinput.c
index 0543bc4..f176a00 100644
--- a/libevdev/libevdev-uinput.c
+++ b/libevdev/libevdev-uinput.c
@@ -334,6 +334,9 @@ error:
LIBEVDEV_EXPORT void
libevdev_uinput_destroy(struct libevdev_uinput *uinput_dev)
{
+ if (!uinput_dev)
+ return;
+
ioctl(uinput_dev->fd, UI_DEV_DESTROY, NULL);
if (uinput_dev->fd_is_managed)
close(uinput_dev->fd);
--
1.9.0
More information about the Input-tools
mailing list