Skip to content

Fix GAppInfo leaks in thunar_g_app_info_launch

correctmost requested to merge correctmost/thunar:cm/fix-gappinfo-leaks into master

Leak report

Direct leak of 200 byte(s) in 1 object(s) allocated from:
    #0 0x59941d532c59 in calloc (/usr/asan/bin/thunar+0x498c59)
    #1 0x754f899d50ca in g_malloc0 glib/gmem.c:133:13
    #2 0x754f89bb74ac in g_type_create_instance gobject/gtype.c:1933:17
    #3 0x754f89b86a0d in g_object_new_internal gobject/gobject.c:2606:24
    #4 0x754f89b86467 in g_object_new_valist gobject/gobject.c:2945:16
    #5 0x754f89b8510b in g_object_new gobject/gobject.c:2418:12
    #6 0x754f89f23d37 in g_desktop_app_info_new_from_filename_unlocked gio/gdesktopappinfo.c:1045:10
    #7 0x754f89f23eb7 in desktop_file_dir_unindexed_get_app gio/gdesktopappinfo.c:1064:10
    #8 0x754f89f23eb7 in desktop_file_dir_get_app gio/gdesktopappinfo.c:1522:10
    #9 0x754f89f23eb7 in g_desktop_app_info_new gio/gdesktopappinfo.c:2145:17
    #10 0x754f89f24ad4 in g_app_info_get_recommended_for_type_impl gio/gdesktopappinfo.c:4497:14
    #11 0x59941d6f51bd in thunar_g_app_info_launch thunar/thunar-gio-extensions.c:1114:39
    #12 0x59941d5ea45b in thunar_action_manager_open_paths thunar/thunar-action-manager.c:936:8
    #13 0x754f89995441 in g_hash_table_foreach glib/ghash.c:2128:9
    #14 0x59941d5e96d8 in thunar_action_manager_open_files thunar/thunar-action-manager.c:900:3
    #15 0x59941d5e821c in thunar_action_manager_poke_files_finish thunar/thunar-action-manager.c:1284:15
    #16 0x59941d6154e8 in thunar_browser_poke_file_internal thunar/thunar-browser.c:498:9
    #17 0x59941d6147ab in thunar_browser_poke_file thunar/thunar-browser.c:537:3
    #18 0x59941d5ca73a in thunar_action_manager_poke thunar/thunar-action-manager.c:1075:7
    #19 0x59941d5c99f4 in thunar_action_manager_activate_selected_files thunar/thunar-action-manager.c:775:3
    #20 0x59941d5de988 in thunar_action_manager_menu_item_activated thunar/thunar-action-manager.c:752:3
[...snip...]

Steps to reproduce

  • To test with a Makefile:
    • Ensure there's no association for "text/x-makefile" in ~/.config/mimeapps.list
    • Right-click on a Makefile and choose Open With > Mousepad

Testing

  • No issues were detected with LSan, ASan, or Valgrind when testing the patch

Merge request reports