From 4f515a1da768f1de61d6e6bccefd53583269e36b Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 18 Jun 2021 12:57:26 +0300 Subject: [PATCH] tests: fix all leaks in linux-explicit-synchronization-test Fix all ASan reported leaks in this test. Signed-off-by: Pekka Paalanen --- tests/linux-explicit-synchronization-test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/linux-explicit-synchronization-test.c b/tests/linux-explicit-synchronization-test.c index 4d4c24be..4d3bffab 100644 --- a/tests/linux-explicit-synchronization-test.c +++ b/tests/linux-explicit-synchronization-test.c @@ -111,6 +111,7 @@ TEST(second_surface_synchronization_on_surface_raises_error) zwp_linux_surface_synchronization_v1_destroy(surface_sync2); zwp_linux_surface_synchronization_v1_destroy(surface_sync1); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(set_acquire_fence_with_invalid_fence_raises_error) @@ -136,6 +137,7 @@ TEST(set_acquire_fence_with_invalid_fence_raises_error) close(pipefd[1]); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(set_acquire_fence_on_destroyed_surface_raises_error) @@ -151,6 +153,7 @@ TEST(set_acquire_fence_on_destroyed_surface_raises_error) assert(pipe(pipefd) == 0); wl_surface_destroy(client->surface->wl_surface); + client->surface->wl_surface = NULL; zwp_linux_surface_synchronization_v1_set_acquire_fence(surface_sync, pipefd[0]); expect_protocol_error( @@ -162,6 +165,7 @@ TEST(set_acquire_fence_on_destroyed_surface_raises_error) close(pipefd[1]); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(second_buffer_release_in_commit_raises_error) @@ -191,6 +195,7 @@ TEST(second_buffer_release_in_commit_raises_error) zwp_linux_buffer_release_v1_destroy(buffer_release1); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(get_release_without_buffer_raises_commit_error) @@ -215,6 +220,7 @@ TEST(get_release_without_buffer_raises_commit_error) zwp_linux_buffer_release_v1_destroy(buffer_release); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(get_release_on_destroyed_surface_raises_error) @@ -228,6 +234,7 @@ TEST(get_release_on_destroyed_surface_raises_error) struct zwp_linux_buffer_release_v1 *buffer_release; wl_surface_destroy(client->surface->wl_surface); + client->surface->wl_surface = NULL; buffer_release = zwp_linux_surface_synchronization_v1_get_release(surface_sync); expect_protocol_error( @@ -238,6 +245,7 @@ TEST(get_release_on_destroyed_surface_raises_error) zwp_linux_buffer_release_v1_destroy(buffer_release); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(get_release_after_commit_succeeds) @@ -269,6 +277,7 @@ TEST(get_release_after_commit_succeeds) zwp_linux_buffer_release_v1_destroy(buffer_release1); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } static void @@ -359,6 +368,7 @@ TEST(get_release_events_are_emitted_for_different_buffers) zwp_linux_buffer_release_v1_destroy(buffer_release1); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(get_release_events_are_emitted_for_same_buffer_on_surface) @@ -418,6 +428,7 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_surface) zwp_linux_buffer_release_v1_destroy(buffer_release1); zwp_linux_surface_synchronization_v1_destroy(surface_sync); zwp_linux_explicit_synchronization_v1_destroy(sync); + client_destroy(client); } TEST(get_release_events_are_emitted_for_same_buffer_on_different_surfaces) @@ -495,4 +506,6 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_different_surfaces) zwp_linux_surface_synchronization_v1_destroy(surface_sync2); zwp_linux_surface_synchronization_v1_destroy(surface_sync1); zwp_linux_explicit_synchronization_v1_destroy(sync); + surface_destroy(other_surface); + client_destroy(client); }