[gnome-software] trivial: Fix two memory leaks in the appstream plugin
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Fix two memory leaks in the appstream plugin
- Date: Thu, 23 Feb 2017 15:51:40 +0000 (UTC)
commit b3d773d22a0285e332038875057d69fe2d9ff8bf
Author: Richard Hughes <richard hughsie com>
Date: Thu Feb 23 15:37:18 2017 +0000
trivial: Fix two memory leaks in the appstream plugin
src/plugins/gs-appstream.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 9eec899..3a548f9 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -36,8 +36,10 @@ gs_appstream_create_app (GsPlugin *plugin, AsApp *item, GError **error)
app = gs_app_new (as_app_get_id (item));
gs_app_set_metadata (app, "GnomeSoftware::Creator",
gs_plugin_get_name (plugin));
- if (!gs_appstream_refine_app (plugin, app, item, error))
+ if (!gs_appstream_refine_app (plugin, app, item, error)) {
+ g_object_unref (app);
return NULL;
+ }
gs_plugin_cache_add (plugin, unique_id, app);
}
return app;
@@ -306,9 +308,9 @@ gs_appstream_create_runtime (GsPlugin *plugin,
GsApp *parent,
const gchar *runtime)
{
- GsApp *app_cache;
g_autofree gchar *source = NULL;
g_auto(GStrv) split = NULL;
+ g_autoptr(GsApp) app_cache = NULL;
g_autoptr(GsApp) app = NULL;
/* get the name/arch/branch */
@@ -333,7 +335,7 @@ gs_appstream_create_runtime (GsPlugin *plugin,
* source is set */
if (gs_app_get_source_default (app_cache) == NULL)
gs_app_add_source (app_cache, source);
- return g_object_ref (app_cache);
+ return g_steal_pointer (&app_cache);
}
/* save in the cache */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]