Ignore NULL as argument in libevdev_uinput_destroy()

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@arcor.de>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
Tested-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-05-02 07:53:24 +10:00
parent b5a39e9e05
commit d0af7f2851

View file

@ -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);