From: Peter Hutterer Date: Wed, 23 Apr 2014 01:04:48 +0000 (+1000) Subject: test: fix a couple of memleaks in the tests X-Git-Tag: 0.2.0~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54431242ce7faf1343bda3329e7c3b05a27375e5;p=platform%2Fupstream%2Flibinput.git test: fix a couple of memleaks in the tests Signed-off-by: Peter Hutterer --- diff --git a/test/keyboard.c b/test/keyboard.c index f8130670..a518b66c 100644 --- a/test/keyboard.c +++ b/test/keyboard.c @@ -55,6 +55,7 @@ START_TEST(keyboard_seat_key_count) while ((ev = libinput_get_event(libinput))) { if (libinput_event_get_type(ev) != LIBINPUT_EVENT_KEYBOARD_KEY) { + libinput_event_destroy(ev); libinput_dispatch(libinput); continue; } @@ -70,6 +71,7 @@ START_TEST(keyboard_seat_key_count) libinput_event_keyboard_get_seat_key_count(kev); ck_assert_int_eq(expected_key_button_count, seat_key_count); + libinput_event_destroy(ev); libinput_dispatch(libinput); } @@ -82,6 +84,7 @@ START_TEST(keyboard_seat_key_count) while ((ev = libinput_get_event(libinput))) { if (libinput_event_get_type(ev) != LIBINPUT_EVENT_KEYBOARD_KEY) { + libinput_event_destroy(ev); libinput_dispatch(libinput); continue; } @@ -97,6 +100,7 @@ START_TEST(keyboard_seat_key_count) libinput_event_keyboard_get_seat_key_count(kev); ck_assert_int_eq(expected_key_button_count, seat_key_count); + libinput_event_destroy(ev); libinput_dispatch(libinput); } diff --git a/test/pointer.c b/test/pointer.c index b172c2a5..cae9f097 100644 --- a/test/pointer.c +++ b/test/pointer.c @@ -212,6 +212,7 @@ START_TEST(pointer_seat_button_count) while ((ev = libinput_get_event(libinput))) { if (libinput_event_get_type(ev) != LIBINPUT_EVENT_POINTER_BUTTON) { + libinput_event_destroy(ev); libinput_dispatch(libinput); continue; } @@ -228,6 +229,7 @@ START_TEST(pointer_seat_button_count) libinput_event_pointer_get_seat_button_count(tev); ck_assert_int_eq(expected_seat_button_count, seat_button_count); + libinput_event_destroy(ev); libinput_dispatch(libinput); } @@ -240,6 +242,7 @@ START_TEST(pointer_seat_button_count) while ((ev = libinput_get_event(libinput))) { if (libinput_event_get_type(ev) != LIBINPUT_EVENT_POINTER_BUTTON) { + libinput_event_destroy(ev); libinput_dispatch(libinput); continue; } @@ -256,6 +259,7 @@ START_TEST(pointer_seat_button_count) libinput_event_pointer_get_seat_button_count(tev); ck_assert_int_eq(expected_seat_button_count, seat_button_count); + libinput_event_destroy(ev); libinput_dispatch(libinput); } diff --git a/test/touch.c b/test/touch.c index 96915e73..41ecc18d 100644 --- a/test/touch.c +++ b/test/touch.c @@ -147,6 +147,7 @@ START_TEST(touch_many_slots) else if (type == LIBINPUT_EVENT_TOUCH_UP) break; + libinput_event_destroy(ev); libinput_dispatch(libinput); } @@ -160,10 +161,13 @@ START_TEST(touch_many_slots) if (type == LIBINPUT_EVENT_TOUCH_UP) slot_count--; + libinput_event_destroy(ev); libinput_dispatch(libinput); } while ((ev = libinput_get_event(libinput))); ck_assert_int_eq(slot_count, 0); + + litest_delete_device(dev); } END_TEST @@ -200,6 +204,7 @@ START_TEST(touch_double_touch_down_up) break; } + libinput_event_destroy(ev); libinput_dispatch(libinput); }