Skip to content
  • Felix Riemann's avatar
    gdesktopappinfo: Fix unnecessarily copied and leaked URI list · 47cdc8e3
    Felix Riemann authored and Philip Withnall's avatar Philip Withnall committed
    When an app is spawned using g_desktop_app_info_launch_uris_with_spawn
    it will expand the various token in the app's commandline with the
    URIs of the files to open. The expand_macro() function that is used for
    this advances the pointer to the URI list to show up to which entries
    it used.
    
    To not loose the pointer to the list head a duplicate of the URI list
    was actually passed to expand_macro(). However, it's not necessary to
    create a copy of the URI list for that as expand_macro() will only
    change which element the pointer will point to.
    
    This behaviour actually caused the duplicated list to be leaked as the
    the list pointer is NULL once all URIs are used up by expand_macro()
    and thus nothing was freed at the end of the function.
    47cdc8e3