test: fix a couple of memleaks in the tests
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 23 Apr 2014 01:04:48 +0000 (11:04 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 23 Apr 2014 02:43:23 +0000 (12:43 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/keyboard.c
test/pointer.c
test/touch.c

index f81306706f461c2ccf2bd6221e91afc69b98c26e..a518b66ce98d11fc7ff8f262ced0bbaef460fbb0 100644 (file)
@@ -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);
        }
 
index b172c2a5ffd37d0555ff47cc0569a71757896984..cae9f09728e50479e542fdb83bf20e63fb299377 100644 (file)
@@ -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);
        }
 
index 96915e73c89af2a17e34246599461189d3ff61ed..41ecc18d83e273a126f7fd1636a4b1ba1595f607 100644 (file)
@@ -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);
        }