Fix a memory leaks

When iterating more than one group, the variable got clobbered.
Narrowing their scope helps.
This was triggered installing an Inkscape test build

Signed-off-by: Hubert Figuière <hub@figuiere.net>
This commit is contained in:
Hubert Figuière
2024-10-05 09:24:45 -04:00
committed by Patrick
parent 9b4f5baa95
commit b520ec5961

View File

@@ -7551,9 +7551,6 @@ export_desktop_file (const char *app,
g_autofree gchar *new_data = NULL;
gsize new_data_len;
g_autoptr(GKeyFile) keyfile = NULL;
g_autofree gchar *old_exec = NULL;
gint old_argc;
g_auto(GStrv) old_argv = NULL;
g_auto(GStrv) groups = NULL;
g_autofree char *escaped_app = maybe_quote (app);
g_autofree char *escaped_branch = maybe_quote (branch);
@@ -7678,6 +7675,9 @@ export_desktop_file (const char *app,
for (i = 0; groups[i] != NULL; i++)
{
gint old_argc;
g_auto(GStrv) old_argv = NULL;
g_autofree gchar *old_exec = NULL;
g_autoptr(GString) new_exec = NULL;
g_auto(GStrv) flatpak_run_opts = g_key_file_get_string_list (keyfile, groups[i], "X-Flatpak-RunOptions", NULL, NULL);
g_autofree char *flatpak_run_args = format_flatpak_run_args_from_run_opts (flatpak_run_opts);