From dded404c33737ff03d13d77417706903ec6578bd Mon Sep 17 00:00:00 2001 From: Matthew Leeds Date: Thu, 5 Dec 2019 10:10:43 -0800 Subject: installation: Don't re-use a GError pointer Here we're using the same GError pointer multiple times without clearing it, which is an error. Use a local_error and print a debug message instead, which matches the behavior in the loop above. --- common/flatpak-installation.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/flatpak-installation.c b/common/flatpak-installation.c index 9928ef57..3edd2fb1 100644 --- a/common/flatpak-installation.c +++ b/common/flatpak-installation.c @@ -1105,6 +1105,7 @@ flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self, g_autofree char *key = g_strdup_printf ("%s:%s", remote_name, full_ref); const char *remote_commit = g_hash_table_lookup (remote_commits, key); const char *local_commit = flatpak_installed_ref_get_latest_commit (installed_ref); + g_autoptr(GError) local_error = NULL; if (flatpak_dir_ref_is_masked (dir, full_ref)) continue; @@ -1130,9 +1131,13 @@ flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self, if (state == NULL) { - state = flatpak_dir_get_remote_state_optional (dir, remote_name, FALSE, cancellable, error); + state = flatpak_dir_get_remote_state_optional (dir, remote_name, FALSE, cancellable, &local_error); if (state == NULL) - continue; + { + g_debug ("Update: Failed to get remote state for %s: %s", + remote_name, local_error->message); + continue; + } g_hash_table_insert (remote_states, g_strdup (remote_name), state); } -- cgit v1.2.1