summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalev Lember <klember@redhat.com>2018-12-14 12:16:21 +0100
committerKalev Lember <klember@redhat.com>2018-12-14 13:44:33 +0100
commit30db8cd59530daf89567e9da0875b31b3a2a4cf9 (patch)
tree793ee7c79c2c0db58bdb55a050cdca141b1fabd6
parent24913fb9ac74f671fdba7547049bcaa0899704ee (diff)
downloadappstream-glib-30db8cd59530daf89567e9da0875b31b3a2a4cf9.tar.gz
store: trivial: Fix a possibly memory leak in as_store_validate
When returning early we were leaking GPtrArray *probs which never got freed. Change it to use g_autoptr to avoid that.
-rw-r--r--libappstream-glib/as-store.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index 0308585..e572374 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -3623,7 +3623,7 @@ as_store_validate (AsStore *store, guint32 flags, GError **error)
{
AsStorePrivate *priv = GET_PRIVATE (store);
AsApp *app;
- GPtrArray *probs;
+ g_autoptr(GPtrArray) probs = NULL;
guint i;
g_autoptr(GHashTable) hash_names = NULL;
g_autoptr(GPtrArray) apps = NULL;
@@ -3844,7 +3844,7 @@ as_store_validate (AsStore *store, guint32 flags, GError **error)
}
}
}
- return probs;
+ return g_steal_pointer (&probs);
}
static void