summaryrefslogtreecommitdiff
path: root/src/ostree/ot-dump.c
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2020-08-10 12:07:22 +0100
committerPhilip Withnall <pwithnall@endlessos.org>2020-10-01 11:06:56 +0100
commit23bdc4e5df41a1f53ce387f90eaf6b79c644b2da (patch)
tree1978fd698199dbe5d6a697b4ff9488979036b59b /src/ostree/ot-dump.c
parent8d09a1a8eaaedcc8fb1fc111a61616e9f7ad9a4e (diff)
downloadostree-23bdc4e5df41a1f53ce387f90eaf6b79c644b2da.tar.gz
ostree/dump: Fix a memory leak
Re-using the `refs` variable for the main list of refs, plus the iterated lists, meant that the main list was never freed (although all the iterated ones were freed correctly). Fix this by using two variables rather than reusing the one. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Diffstat (limited to 'src/ostree/ot-dump.c')
-rw-r--r--src/ostree/ot-dump.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ostree/ot-dump.c b/src/ostree/ot-dump.c
index 1f911d4e..a8ed54a2 100644
--- a/src/ostree/ot-dump.c
+++ b/src/ostree/ot-dump.c
@@ -322,10 +322,11 @@ ot_dump_summary_bytes (GBytes *summary_bytes,
collection_map = g_variant_lookup_value (exts, OSTREE_SUMMARY_COLLECTION_MAP, G_VARIANT_TYPE ("a{sa(s(taya{sv}))}"));
if (collection_map != NULL)
{
+ g_autoptr(GVariant) collection_refs = NULL;
g_variant_iter_init (&iter, collection_map);
- while (g_variant_iter_loop (&iter, "{&s@a(s(taya{sv}))}", &collection_id, &refs))
- dump_summary_refs (collection_id, refs);
+ while (g_variant_iter_loop (&iter, "{&s@a(s(taya{sv}))}", &collection_id, &collection_refs))
+ dump_summary_refs (collection_id, collection_refs);
}
/* Print out the additional metadata. */