[PATCH libevdev] Ignore NULL as argument in libevdev_uinput_destroy()

Daniel Martin consume.noise at gmail.com
Thu May 1 15:06:46 PDT 2014


On Fri, May 02, 2014 at 07:56:40AM +1000, Peter Hutterer wrote:
> 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

Reviewed- and Tested-by: Daniel Martin <consume.noise at gmail.com>


More information about the Input-tools mailing list