diff options
author | Philip Withnall <withnall@endlessm.com> | 2019-07-29 18:00:53 +0100 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-08-03 05:03:23 +0000 |
commit | f80cce6b8d6a397a232c3a88bf1411f7045cc5e4 (patch) | |
tree | dfc0592ea093a21e67b256ada1beaf2f0259e11a | |
parent | eaec3a8203e5f8dc8b7f2282676981ff6d703110 (diff) | |
download | flatpak-f80cce6b8d6a397a232c3a88bf1411f7045cc5e4.tar.gz |
installation: Fix a small leak of a FlatpakCollectionRef
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #3031
Approved by: mwleeds
-rw-r--r-- | common/flatpak-installation.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/common/flatpak-installation.c b/common/flatpak-installation.c index 7fe20f02..7b651a27 100644 --- a/common/flatpak-installation.c +++ b/common/flatpak-installation.c @@ -976,6 +976,16 @@ async_result_cb (GObject *obj, *result_out = g_object_ref (result); } +/* Useful as the #GDestroyNotify in NULL-terminated pointer arrays. */ +static void +_ostree_collection_ref_free0 (OstreeCollectionRef *ref) +{ + if (ref == NULL) + return; + + ostree_collection_ref_free (ref); +} + /** * flatpak_installation_list_installed_refs_for_update: * @self: a #FlatpakInstallation @@ -1077,7 +1087,7 @@ flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self, if (dir == NULL) return NULL; - collection_refs = g_ptr_array_new (); + collection_refs = g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_collection_ref_free0); refs_str = g_string_new (""); for (i = 0; i < installed->len; i++) |