From a1f020ffa45f9cb7dad86e4c87a3f78b6f47997c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 19 Oct 2017 14:04:10 +0100 Subject: [PATCH] lib/repo-finder-avahi: Fix a leak in a GVariantIter loop Use g_variant_iter_loop() rather than next(), since it automatically handles freeing the child memory each iteration. Previously, we leaked it for all but the last iteration. Signed-off-by: Philip Withnall Closes: #1293 Approved by: cgwalters --- src/libostree/ostree-repo-finder-avahi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo-finder-avahi.c b/src/libostree/ostree-repo-finder-avahi.c index a39d9533..0c88ad60 100644 --- a/src/libostree/ostree-repo-finder-avahi.c +++ b/src/libostree/ostree-repo-finder-avahi.c @@ -429,7 +429,7 @@ fill_refs_and_checksums_from_summary_map (GVariantIter *summary_map, g_autofree gchar *ref_name = NULL; g_autoptr(GVariant) checksum_variant = NULL; - while (g_variant_iter_next (summary_map, "(s(t@aya{sv}))", + while (g_variant_iter_loop (summary_map, "(s(t@aya{sv}))", (gpointer *) &ref_name, NULL, (gpointer *) &checksum_variant, NULL)) { -- 2.30.2