Fix a ThunarxMenu leak in tvp_git_action_create_menu_item
Description
I see these leaks when just starting and exiting Thunar with thunar-vcs-plugin installed.
Leak report
Direct leak of 96 byte(s) in 2 object(s) allocated from:
#0 0x7f0d1b12073d in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:74
#1 0x7f0d18db6735 in g_malloc0 glib/gmem.c:133
#2 0x7f0d195859d0 in g_type_create_instance gobject/gtype.c:1882
#3 0x7f0d1952dda5 in g_object_new_internal gobject/gobject.c:2687
#4 0x7f0d19532b2a in g_object_new_with_properties gobject/gobject.c:2849
#5 0x7f0d19534877 in g_object_new gobject/gobject.c:2498
#6 0x7f0d1afcd74e in IA__thunarx_menu_new thunarx/thunarx-menu.c:103
#7 0x7b0d073e1d1e in tvp_git_action_create_menu_item thunar-vcs-plugin/tvp-git-action.c:220
#8 0x7b0d073e1d1e in tvp_git_action_new thunar-vcs-plugin/tvp-git-action.c:162
#9 0x7b0d073e02b2 in tvp_provider_get_file_menu_items thunar-vcs-plugin/tvp-provider.c:459
#10 0x7f0d1afcc739 in IA__thunarx_menu_provider_get_file_menu_items thunarx/thunarx-menu-provider.c:126
#11 0x5713e880a12e in thunar_action_manager_check_uca_key_activation thunar/thunar-action-manager.c:2523
#12 0x5713e89c1e7c in thunar_window_check_uca_key_activation thunar/thunar-window.c:4887
[...snip...]
Direct leak of 96 byte(s) in 2 object(s) allocated from:
#0 0x7f0d1b12073d in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:74
#1 0x7f0d18db6735 in g_malloc0 glib/gmem.c:133
#2 0x7f0d195859d0 in g_type_create_instance gobject/gtype.c:1882
#3 0x7f0d1952dda5 in g_object_new_internal gobject/gobject.c:2687
#4 0x7f0d19532b2a in g_object_new_with_properties gobject/gobject.c:2849
#5 0x7f0d19534877 in g_object_new gobject/gobject.c:2498
#6 0x7f0d1afcd74e in IA__thunarx_menu_new thunarx/thunarx-menu.c:103
#7 0x7b0d073e1d1e in tvp_git_action_create_menu_item thunar-vcs-plugin/tvp-git-action.c:220
#8 0x7b0d073e1d1e in tvp_git_action_new thunar-vcs-plugin/tvp-git-action.c:162
#9 0x7b0d073dfd06 in tvp_provider_get_folder_menu_items thunar-vcs-plugin/tvp-provider.c:501
#10 0x7f0d1afccbca in IA__thunarx_menu_provider_get_folder_menu_items thunarx/thunarx-menu-provider.c:182
#11 0x5713e880a186 in thunar_action_manager_check_uca_key_activation thunar/thunar-action-manager.c:2524
#12 0x5713e89c1e7c in thunar_window_check_uca_key_activation thunar/thunar-window.c:4887
[...snip...]
Direct leak of 48 byte(s) in 1 object(s) allocated from:
#0 0x7f0d1b12073d in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:74
#1 0x7f0d18db6735 in g_malloc0 glib/gmem.c:133
#2 0x7f0d195859d0 in g_type_create_instance gobject/gtype.c:1882
#3 0x7f0d1952dda5 in g_object_new_internal gobject/gobject.c:2687
#4 0x7f0d19532b2a in g_object_new_with_properties gobject/gobject.c:2849
#5 0x7f0d19534877 in g_object_new gobject/gobject.c:2498
#6 0x7f0d1afcd74e in IA__thunarx_menu_new thunarx/thunarx-menu.c:103
#7 0x7b0d073e1d1e in tvp_git_action_create_menu_item thunar-vcs-plugin/tvp-git-action.c:220
#8 0x7b0d073e1d1e in tvp_git_action_new thunar-vcs-plugin/tvp-git-action.c:162
#9 0x7b0d073dfd06 in tvp_provider_get_folder_menu_items thunar-vcs-plugin/tvp-provider.c:501
#10 0x7f0d1afccbca in IA__thunarx_menu_provider_get_folder_menu_items thunarx/thunarx-menu-provider.c:182
#11 0x5713e89eb3f6 in thunar_window_location_toolbar_add_ucas thunar/thunar-window.c:6939
#12 0x5713e89eb3f6 in thunar_window_location_toolbar_create thunar/thunar-window.c:6771
#13 0x5713e89f05dd 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