ostree_repo_find_remotes_async: Fix leak of summary
authorAlexander Larsson <alexl@redhat.com>
Mon, 14 Sep 2020 11:52:10 +0000 (13:52 +0200)
committerAlexander Larsson <alexl@redhat.com>
Thu, 8 Oct 2020 12:08:51 +0000 (14:08 +0200)
We were creating a GVariant from a GBytes and storing it in an
g_autoptr without ref_sinking it.

src/libostree/ostree-repo-pull.c

index f16ccec508399ac8f2f939104e54cbe5a8520f93..ab32b54e7f23936e829751d44d95ee6a605dfbed 100644 (file)
@@ -5372,8 +5372,8 @@ find_remotes_cb (GObject      *obj,
 
       /* Check the metadata in the summary file, especially whether it contains
        * all the @refs we are interested in. */
-      summary_v = g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
-                                            summary_bytes, FALSE);
+      summary_v = g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
+                                                                summary_bytes, FALSE));
 
       /* Check the summary’s additional metadata and set up @commit_metadata
        * and @refs_and_remotes_table with the refs listed in the summary file,