Fix thunarx_menu_get_items leak when multiple UCAs share a submenu
Description
This leak is reproducible when you have two UCAs that share the same submenu.
Leak report
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7f8ecb920e15 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:67
#1 0x7f8ec95b66e1 in g_malloc glib/gmem.c:100
#2 0x7f8ec960ca44 in g_slice_alloc glib/gslice.c:193
#3 0x7f8ec95877cf in g_list_copy_deep glib/glist.c:678
#4 0x7f8ec9587c02 in g_list_copy glib/glist.c:631
#5 0x7f8ecb7cdb01 in IA__thunarx_menu_get_items thunarx/thunarx-menu.c:154
#6 0x7b8eb59ac4e5 in find_submenu_by_name plugins/thunar-uca/thunar-uca-provider.c:219
#7 0x7b8eb59ac958 in thunar_uca_provider_get_file_menu_items plugins/thunar-uca/thunar-uca-provider.c:303
#8 0x7f8ecb7cc739 in IA__thunarx_menu_provider_get_file_menu_items thunarx/thunarx-menu-provider.c:126
#9 0x7b8eb59ac16b in thunar_uca_provider_get_folder_menu_items plugins/thunar-uca/thunar-uca-provider.c:428
#10 0x7f8ecb7ccbca in IA__thunarx_menu_provider_get_folder_menu_items thunarx/thunarx-menu-provider.c:182
#11 0x56eb241d3bf2 in thunar_action_manager_append_custom_actions thunar/thunar-action-manager.c:2423
#12 0x56eb242a3ad8 in thunar_menu_add_sections thunar/thunar-menu.c:335
#13 0x56eb24333caf in thunar_standard_view_context_menu thunar/thunar-standard-view.c:4229
#14 0x56eb241ba805 in thunar_abstract_icon_view_button_press_event thunar/thunar-abstract-icon-view.c:452
[...snip...]
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7f8ecb920e15 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:67
#1 0x7f8ec95b66e1 in g_malloc glib/gmem.c:100
#2 0x7f8ec960ca44 in g_slice_alloc glib/gslice.c:193
#3 0x7f8ec95877cf in g_list_copy_deep glib/glist.c:678
#4 0x7f8ec9587c02 in g_list_copy glib/glist.c:631
#5 0x7f8ecb7cdb01 in IA__thunarx_menu_get_items thunarx/thunarx-menu.c:154
#6 0x7b8eb59ac4e5 in find_submenu_by_name plugins/thunar-uca/thunar-uca-provider.c:219
#7 0x7b8eb59ac958 in thunar_uca_provider_get_file_menu_items plugins/thunar-uca/thunar-uca-provider.c:303
#8 0x7f8ecb7cc739 in IA__thunarx_menu_provider_get_file_menu_items thunarx/thunarx-menu-provider.c:126
#9 0x7b8eb59ac16b in thunar_uca_provider_get_folder_menu_items plugins/thunar-uca/thunar-uca-provider.c:428
#10 0x7f8ecb7ccbca in IA__thunarx_menu_provider_get_folder_menu_items thunarx/thunarx-menu-provider.c:182
#11 0x56eb243b53f6 in thunar_window_location_toolbar_add_ucas thunar/thunar-window.c:6939
#12 0x56eb243b53f6 in thunar_window_location_toolbar_create thunar/thunar-window.c:6771
#13 0x56eb243ba5dd in thunar_window_init thunar/thunar-window.c:1198
[...snip...]
Testing
- No issues were detected when testing the patch with UBSan, LSan, ASan, and Valgrind