From: Philip Withnall Date: Thu, 19 Oct 2017 13:04:10 +0000 (+0100) Subject: lib/repo-finder-avahi: Fix a leak in a GVariantIter loop X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~30^2~34 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a1f020ffa45f9cb7dad86e4c87a3f78b6f47997c;p=ostree.git 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 --- 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)) {