[gnome-software/gnome-3-24] snap: Fix leak of GsApp
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-24] snap: Fix leak of GsApp
- Date: Fri, 27 Oct 2017 00:46:22 +0000 (UTC)
commit 69c441d30bad261b59dda71103065e8c0d39d926
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Sep 29 11:19:19 2017 -0400
snap: Fix leak of GsApp
plugins/snap/gs-plugin-snap.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 88f763a..d5355b1 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -260,8 +260,8 @@ gs_plugin_add_popular (GsPlugin *plugin,
return FALSE;
for (i = 0; i < json_array_get_length (snaps); i++) {
- JsonObject *snap = json_array_get_object_element (snaps, i);
- gs_app_list_add (list, snap_to_app (plugin, snap));
+ g_autoptr(GsApp) app = snap_to_app (plugin, json_array_get_object_element (snaps, i));
+ gs_app_list_add (list, app);
}
return TRUE;
@@ -285,13 +285,15 @@ gs_plugin_add_installed (GsPlugin *plugin,
for (i = 0; i < json_array_get_length (snaps); i++) {
JsonObject *snap = json_array_get_object_element (snaps, i);
+ g_autoptr(GsApp) app = NULL;
const gchar *status;
status = json_object_get_string_member (snap, "status");
if (g_strcmp0 (status, "active") != 0)
continue;
- gs_app_list_add (list, snap_to_app (plugin, snap));
+ app = snap_to_app (plugin, snap);
+ gs_app_list_add (list, app);
}
return TRUE;
@@ -314,8 +316,8 @@ gs_plugin_add_search (GsPlugin *plugin,
return FALSE;
for (i = 0; i < json_array_get_length (snaps); i++) {
- JsonObject *snap = json_array_get_object_element (snaps, i);
- gs_app_list_add (list, snap_to_app (plugin, snap));
+ g_autoptr(GsApp) app = snap_to_app (plugin, json_array_get_object_element (snaps, i));
+ gs_app_list_add (list, app);
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]