From b520ec5961036bc4e3a09c1d2438b4a2a1709f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Figui=C3=A8re?= Date: Sat, 5 Oct 2024 09:24:45 -0400 Subject: [PATCH] Fix a memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- common/flatpak-dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 389b6dc0..6752a7f1 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -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);