summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-06-11 10:43:32 +0100
committerRichard Hughes <richard@hughsie.com>2014-06-11 10:43:32 +0100
commit3b84eb22754f7c23dd899e12b0d56232b7c05894 (patch)
treee815b7f2e35fb5fb23f98c6c868034ca4c7a270c
parentc4dcf6f23e40d5dc11894d218f1cf7f61f87ac20 (diff)
downloadappstream-glib-3b84eb22754f7c23dd899e12b0d56232b7c05894.tar.gz
trivial: Use more _cleanup_ functions
-rw-r--r--libappstream-glib/as-store.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index 0c2e09a..c7544fd 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -388,9 +388,7 @@ as_store_from_root (AsStore *store,
const gchar *icon_root,
GError **error)
{
- AsApp *app;
AsStorePrivate *priv = GET_PRIVATE (store);
- GError *error_local = NULL;
GNode *apps;
GNode *n;
const gchar *tmp;
@@ -429,6 +427,8 @@ as_store_from_root (AsStore *store,
NULL);
}
for (n = apps->children; n != NULL; n = n->next) {
+ _cleanup_error_free_ GError *error_local = NULL;
+ _cleanup_object_unref_ AsApp *app = NULL;
if (as_node_get_tag (n) != AS_TAG_APPLICATION)
continue;
app = as_app_new ();
@@ -441,12 +441,9 @@ as_store_from_root (AsStore *store,
AS_STORE_ERROR_FAILED,
"Failed to parse root: %s",
error_local->message);
- g_error_free (error_local);
- g_object_unref (app);
return FALSE;
}
as_store_add_app (store, app);
- g_object_unref (app);
}
/* add addon kinds to their parent AsApp */