Fix leaks in thunar_uca_provider_get_file_menu_items
Description
thunarx_menu_prepend_item
and thunarx_menu_item_set_menu
take references, so additional g_object_unref
calls were needed.
When combined with !662 (merged) and !663 (merged), this commit fixes the leaks reported below.
Leak report
Direct leak of 96 byte(s) in 2 object(s) allocated from:
#0 0x7c6dd592073d in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:74
#1 0x7c6dd35b55b5 in g_malloc0 glib/gmem.c:133
#2 0x7c6dd3d85b2e in g_type_create_instance gobject/gtype.c:1882
#3 0x7c6dd3d2df0b in g_object_new_internal gobject/gobject.c:2680
#4 0x7c6dd3d32c93 in g_object_new_with_properties gobject/gobject.c:2842
#5 0x7c6dd3d349e0 in g_object_new gobject/gobject.c:2491
#6 0x7c6dd60b92e6 in IA__thunarx_menu_new thunarx/thunarx-menu.c:103
#7 0x786dbf55e318 in thunar_uca_provider_get_file_menu_items plugins/thunar-uca/thunar-uca-provider.c:329
#8 0x7c6dd60b7f3b in IA__thunarx_menu_provider_get_file_menu_items thunarx/thunarx-menu-provider.c:126
#9 0x786dbf55ef89 in thunar_uca_provider_get_folder_menu_items plugins/thunar-uca/thunar-uca-provider.c:433
#10 0x7c6dd60b8555 in IA__thunarx_menu_provider_get_folder_menu_items thunarx/thunarx-menu-provider.c:182
#11 0x63d8cbca8440 in thunar_action_manager_append_custom_actions thunar/thunar-action-manager.c:2423
#12 0x63d8cbdcfb71 in thunar_menu_add_sections thunar/thunar-menu.c:335
#13 0x63d8cbe98e1e in thunar_standard_view_context_menu thunar/thunar-standard-view.c:4229
#14 0x63d8cbc8dfc3 in thunar_abstract_icon_view_button_press_event thunar/thunar-abstract-icon-view.c:452/
[...snip...]
Direct leak of 48 byte(s) in 1 object(s) allocated from:
#0 0x7c6dd592073d in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:74
#1 0x7c6dd35b55b5 in g_malloc0 glib/gmem.c:133
#2 0x7c6dd3d85b2e in g_type_create_instance gobject/gtype.c:1882
#3 0x7c6dd3d2df0b in g_object_new_internal gobject/gobject.c:2680
#4 0x7c6dd3d32c93 in g_object_new_with_properties gobject/gobject.c:2842
#5 0x7c6dd3d349e0 in g_object_new gobject/gobject.c:2491
#6 0x7c6dd60b92e6 in IA__thunarx_menu_new thunarx/thunarx-menu.c:103
#7 0x786dbf55e318 in thunar_uca_provider_get_file_menu_items plugins/thunar-uca/thunar-uca-provider.c:329
#8 0x7c6dd60b7f3b in IA__thunarx_menu_provider_get_file_menu_items thunarx/thunarx-menu-provider.c:126
#9 0x786dbf55ef89 in thunar_uca_provider_get_folder_menu_items plugins/thunar-uca/thunar-uca-provider.c:433
#10 0x7c6dd60b8555 in IA__thunarx_menu_provider_get_folder_menu_items thunarx/thunarx-menu-provider.c:182
#11 0x63d8cbf6093f in thunar_window_location_toolbar_add_ucas thunar/thunar-window.c:6954
#12 0x63d8cbf5ef2f in thunar_window_location_toolbar_create thunar/thunar-window.c:6786
#13 0x63d8cbf226c3 in thunar_window_init thunar/thunar-window.c:1198
#14 0x7c6dd3d8670c in g_type_create_instance gobject/gtype.c:1900
#15 0x7c6dd3d2df0b in g_object_new_internal gobject/gobject.c:2680
#16 0x7c6dd3d336de in g_object_new_valist gobject/gobject.c:3018
#17 0x7c6dd3d34972 in g_object_new gobject/gobject.c:2494
#18 0x63d8cbcba713 in thunar_application_open_window thunar/thunar-application.c:1501
#19 0x63d8cbcbc674 in thunar_application_process_files_finish thunar/thunar-application.c:1724
#20 0x63d8cbccc17c in thunar_browser_poke_file_internal thunar/thunar-browser.c:498
#21 0x63d8cbccc45c in thunar_browser_poke_file thunar/thunar-browser.c:537
#22 0x63d8cbcbceb7 in thunar_application_process_files thunar/thunar-application.c:1796
#23 0x63d8cbcbe166 in thunar_application_process_filenames thunar/thunar-application.c:1902
#24 0x63d8cbcb4617 in thunar_application_command_line thunar/thunar-application.c:580
[...snip...]
Testing
- No issues were detected when testing the patch with UBSan, LSan, ASan, and Valgrind