[gnome-software] flatpak: Fix several double-uses of GErrors
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] flatpak: Fix several double-uses of GErrors
- Date: Wed, 15 May 2019 14:49:49 +0000 (UTC)
commit bc855b242ceedebc224a2e44a47512728cbd31cf
Author: Philip Withnall <withnall endlessm com>
Date: Wed May 15 14:45:36 2019 +0100
flatpak: Fix several double-uses of GErrors
If a GError defined in a wider scope is used in a loop, even if defined
using `g_autoptr()`, it needs to be freed before the next loop
iteration.
Signed-off-by: Philip Withnall <withnall endlessm com>
plugins/flatpak/gs-plugin-flatpak.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 3844ca97..ee35be4b 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -58,6 +58,7 @@ gs_plugin_initialize (GsPlugin *plugin)
permission = gs_utils_get_permission (action_id, NULL, &error_local);
if (permission == NULL) {
g_debug ("no permission for %s: %s", action_id, error_local->message);
+ g_clear_error (&error_local);
} else {
priv->has_system_helper = g_permission_get_allowed (permission) ||
g_permission_get_can_acquire (permission);
@@ -373,12 +374,13 @@ gs_plugin_flatpak_find_app_by_ref (GsPlugin *plugin, const gchar *ref,
GCancellable *cancellable, GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
- g_autoptr(GError) error_local = NULL;
g_debug ("finding ref %s", ref);
for (guint i = 0; i < priv->flatpaks->len; i++) {
GsFlatpak *flatpak_tmp = g_ptr_array_index (priv->flatpaks, i);
g_autoptr(GsApp) app = NULL;
+ g_autoptr(GError) error_local = NULL;
+
app = gs_flatpak_ref_to_app (flatpak_tmp, ref, cancellable, &error_local);
if (app == NULL) {
g_debug ("%s", error_local->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]