diff options
author | Matthew Leeds <matthew.leeds@endlessm.com> | 2019-12-05 10:10:43 -0800 |
---|---|---|
committer | Matthew Leeds <matthew.leeds@endlessm.com> | 2019-12-05 17:00:59 -0800 |
commit | dded404c33737ff03d13d77417706903ec6578bd (patch) | |
tree | 0f41840802a676db3c788bf34e28b6badd81b937 | |
parent | 44b6bc7f98b6618e0de2b17925412dff5aedb119 (diff) | |
download | flatpak-dont-reset-gerror.tar.gz |
installation: Don't re-use a GError pointerdont-reset-gerror
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.
-rw-r--r-- | common/flatpak-installation.c | 9 |
1 files 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); } |