From a84bf167a394f6fe4cb179c22546f0d02b518dfb Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 4 Feb 2016 21:08:30 +1000 Subject: [PATCH] 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 --- test/litest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/litest.c b/test/litest.c index 2d31c7bb..05010550 100644 --- a/test/litest.c +++ b/test/litest.c @@ -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);