test: fix leaking libevdev fd

This was the reason for the valgrind test case failures whenever we
accumulated too many tests (see 9c2afae1 and 2a110104). The cause was simply
that we ran out of fds which caused libevdev to fail the scandir() searching
for the event node. That resulted in a NULL devnode and an abort in litest.

Close the fd before freeing the evdev device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2016-02-04 21:08:30 +10:00
parent 57527623ee
commit a84bf167a3

View file

@ -1252,6 +1252,7 @@ litest_delete_device(struct litest_device *d)
libinput_path_remove_device(d->libinput_device);
if (d->owns_context)
libinput_unref(d->libinput);
close(libevdev_get_fd(d->evdev));
libevdev_free(d->evdev);
libevdev_uinput_destroy(d->uinput);
free(d->private);