Commit 88fe7813 authored by Felix Riemann's avatar Felix Riemann

gdesktopappinfo: Fix unnecessarily copied and leaked URI list

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.
parent b101dbda
......@@ -2727,7 +2727,7 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
* internally by expand_macro(), so we need to pass a copy of it instead,
* and also use that copy to control the exit condition of the loop below.
dup_uris = g_list_copy (uris);
dup_uris = uris;
GPid pid;
......@@ -2864,7 +2864,6 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
completed = TRUE;
g_list_free (dup_uris);
g_strfreev (argv);
g_strfreev (envp);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment