From 32aedb9fd696dbba81cdacaa5279ad4836ad98d3 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 15 Jun 2021 16:17:29 +0300 Subject: [PATCH] ivi-shell: destroy desktop Fixes ASan reported leaks: Direct leak of 88 byte(s) in 1 object(s) allocated from: #0 0x7fcdc7382518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518) #1 0x7fcdc2d902f3 in zalloc ../../git/weston/include/libweston/zalloc.h:38 #2 0x7fcdc2d91cc2 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410 #3 0x7fcdc2d89aef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87 #4 0x7fcdc2db7300 in wet_shell_init ../../git/weston/ivi-shell/ivi-shell.c:642 #5 0x7fcdc7261de5 in wet_load_shell ../../git/weston/compositor/main.c:956 #6 0x7fcdc7272baa in wet_main ../../git/weston/compositor/main.c:3410 #7 0x55e12a669e29 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432 #8 0x55e12a66d85d in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528 #9 0x55e12a65dc48 in fixture_setup ../../git/weston/tests/ivi-layout-test-client.c:48 #10 0x55e12a65dcca in fixture_setup_run_ ../../git/weston/tests/ivi-layout-test-client.c:50 #11 0x55e12a66de12 in main ../../git/weston/tests/weston-test-runner.c:661 #12 0x7fcdc6ed709a in __libc_start_main ../csu/libc-start.c:308 #13 0x55e12a65d769 in _start (/home/pq/build/weston-meson/tests/test-ivi-layout-client+0xd769) Indirect leak of 152 byte(s) in 1 object(s) allocated from: #0 0x7fcdc7382518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518) #1 0x7fcdc2d89811 in zalloc ../../git/weston/include/libweston/zalloc.h:38 #2 0x7fcdc2d8992d in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:65 #3 0x7fcdc2db7300 in wet_shell_init ../../git/weston/ivi-shell/ivi-shell.c:642 #4 0x7fcdc7261de5 in wet_load_shell ../../git/weston/compositor/main.c:956 #5 0x7fcdc7272baa in wet_main ../../git/weston/compositor/main.c:3410 #6 0x55e12a669e29 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432 #7 0x55e12a66d85d in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528 #8 0x55e12a65dc48 in fixture_setup ../../git/weston/tests/ivi-layout-test-client.c:48 #9 0x55e12a65dcca in fixture_setup_run_ ../../git/weston/tests/ivi-layout-test-client.c:50 #10 0x55e12a66de12 in main ../../git/weston/tests/weston-test-runner.c:661 #11 0x7fcdc6ed709a in __libc_start_main ../csu/libc-start.c:308 #12 0x55e12a65d769 in _start (/home/pq/build/weston-meson/tests/test-ivi-layout-client+0xd769) Indirect leak of 72 byte(s) in 1 object(s) allocated from: #0 0x7fcdc7382518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518) #1 0x7fcdc2d8a5ae in zalloc ../../git/weston/include/libweston/zalloc.h:38 #2 0x7fcdc2d8a89e in weston_desktop_client_create ../../git/weston/libweston-desktop/client.c:108 #3 0x7fcdc2d91d2a in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:415 #4 0x7fcdc2d89aef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87 #5 0x7fcdc2db7300 in wet_shell_init ../../git/weston/ivi-shell/ivi-shell.c:642 #6 0x7fcdc7261de5 in wet_load_shell ../../git/weston/compositor/main.c:956 #7 0x7fcdc7272baa in wet_main ../../git/weston/compositor/main.c:3410 #8 0x55e12a669e29 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432 #9 0x55e12a66d85d in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528 #10 0x55e12a65dc48 in fixture_setup ../../git/weston/tests/ivi-layout-test-client.c:48 #11 0x55e12a65dcca in fixture_setup_run_ ../../git/weston/tests/ivi-layout-test-client.c:50 #12 0x55e12a66de12 in main ../../git/weston/tests/weston-test-runner.c:661 #13 0x7fcdc6ed709a in __libc_start_main ../csu/libc-start.c:308 #14 0x55e12a65d769 in _start (/home/pq/build/weston-meson/tests/test-ivi-layout-client+0xd769) Signed-off-by: Pekka Paalanen --- ivi-shell/ivi-shell.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c index 4ab39595..5ec1349e 100644 --- a/ivi-shell/ivi-shell.c +++ b/ivi-shell/ivi-shell.c @@ -346,6 +346,8 @@ shell_destroy(struct wl_listener *listener, void *data) wl_list_remove(&shell->destroy_listener.link); wl_list_remove(&shell->wake_listener.link); + weston_desktop_destroy(shell->desktop); + wl_list_for_each_safe(ivisurf, next, &shell->ivi_surface_list, link) { if (ivisurf->layout_surface != NULL) layout_surface_cleanup(ivisurf);