From cc46e00e8192bdc95c16e2636d3073b39bdd2c37 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 9 Jul 2015 16:46:00 +1000 Subject: [PATCH] test: fix memleak in the udev_device_sysname() test If a device sends other events at startup, those events weren't freed. This can happen on tablet devices that send proximity events immediately after DEVICE_ADDED. Signed-off-by: Peter Hutterer --- test/udev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/udev.c b/test/udev.c index b077311a..30ae1180 100644 --- a/test/udev.c +++ b/test/udev.c @@ -413,8 +413,11 @@ START_TEST(udev_device_sysname) libinput_dispatch(li); while ((ev = libinput_get_event(li))) { - if (libinput_event_get_type(ev) != LIBINPUT_EVENT_DEVICE_ADDED) + if (libinput_event_get_type(ev) != + LIBINPUT_EVENT_DEVICE_ADDED) { + libinput_event_destroy(ev); continue; + } device = libinput_event_get_device(ev); sysname = libinput_device_get_sysname(device);