mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-15 20:19:06 +00:00
tests: fix leaks in bad-buffer
Fixes all ASan reported leaks for this test. If frame_callback_wait_nofail() returns before the callback is handled, the callback is not destroyed automatically. This happens on a protocol error. This test intentionally triggers a protocol error. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
b0eb059818
commit
819054ceac
|
@ -170,6 +170,7 @@ TEST(test_truncated_shm_file)
|
|||
struct client *client;
|
||||
struct wl_buffer *bad_buffer;
|
||||
struct wl_surface *surface;
|
||||
struct wl_callback *frame_cb;
|
||||
int frame;
|
||||
|
||||
client = create_client_and_test_surface(46, 76, 111, 134);
|
||||
|
@ -180,10 +181,14 @@ TEST(test_truncated_shm_file)
|
|||
|
||||
wl_surface_attach(surface, bad_buffer, 0, 0);
|
||||
wl_surface_damage(surface, 0, 0, 200, 200);
|
||||
frame_callback_set(surface, &frame);
|
||||
frame_cb = frame_callback_set(surface, &frame);
|
||||
wl_surface_commit(surface);
|
||||
frame_callback_wait_nofail(client, &frame);
|
||||
if (!frame_callback_wait_nofail(client, &frame))
|
||||
wl_callback_destroy(frame_cb);
|
||||
|
||||
expect_protocol_error(client, &wl_buffer_interface,
|
||||
WL_SHM_ERROR_INVALID_FD);
|
||||
|
||||
wl_buffer_destroy(bad_buffer);
|
||||
client_destroy(client);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue