From a01299a5b8351b92595787d064c002af3088f3b0 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 18 Jun 2021 13:09:55 +0300 Subject: [PATCH] tests: fix all leaks in touch-test Fixes all ASan reported leaks. The manual touch release is slightly awkward as we need to open-code a part of input_destroy() to avoid double-freeing pointer->wl_touch. Signed-off-by: Pekka Paalanen --- tests/touch-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/touch-test.c b/tests/touch-test.c index b2133bde..c2b563c9 100644 --- a/tests/touch-test.c +++ b/tests/touch-test.c @@ -89,6 +89,8 @@ TEST(touch_events) assert(timespec_eq(&touch->up_time_timespec, &t3)); input_timestamps_destroy(input_ts); + + client_destroy(client); } TEST(touch_timestamps_stop_after_input_timestamps_object_is_destroyed) @@ -107,6 +109,8 @@ TEST(touch_timestamps_stop_after_input_timestamps_object_is_destroyed) send_touch(client, &t2, WL_TOUCH_UP); assert(touch->up_time_msec == timespec_to_msec(&t2)); assert(timespec_is_zero(&touch->up_time_timespec)); + + client_destroy(client); } TEST(touch_timestamps_stop_after_client_releases_wl_touch) @@ -132,4 +136,8 @@ TEST(touch_timestamps_stop_after_client_releases_wl_touch) assert(timespec_eq(&touch->input_timestamp, &t_other)); input_timestamps_destroy(input_ts); + + free(client->input->touch); + client->input->touch = NULL; + client_destroy(client); }