lib/repo-finder-avahi: Fix a leak in a GVariantIter loop
authorPhilip Withnall <withnall@endlessm.com>
Thu, 19 Oct 2017 13:04:10 +0000 (14:04 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 19 Oct 2017 13:16:59 +0000 (13:16 +0000)
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 <withnall@endlessm.com>
Closes: #1293
Approved by: cgwalters

src/libostree/ostree-repo-finder-avahi.c

index a39d95339b714082a2e81dad799b5c1fa3665903..0c88ad60a5e26ab31df402f81eb4f42815cca091 100644 (file)
@@ -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))
     {