From 6ed1066ef08e3f56b6c09031e82343cc8e0a99d1 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 14 Sep 2020 13:52:10 +0200 Subject: [PATCH 1/3] ostree_repo_find_remotes_async: Fix leak of summary 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index f16ccec5..ab32b54e 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -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, From f821cdb89ec591d5195c4093ba6a9da43a703463 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 16 Sep 2020 12:09:41 +0200 Subject: [PATCH 2/3] fetch_summary_with_options: Fix n-network-retries option parsing "&u" is not a valid gvariant format string, it should just be "u". --- src/libostree/ostree-repo-pull.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index ab32b54e..58c80543 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -6127,7 +6127,7 @@ ostree_repo_remote_fetch_summary_with_options (OstreeRepo *self, (void) g_variant_lookup (options, "override-url", "&s", &url_override); (void) g_variant_lookup (options, "http-headers", "@a(ss)", &extra_headers); (void) g_variant_lookup (options, "append-user-agent", "&s", &append_user_agent); - (void) g_variant_lookup (options, "n-network-retries", "&u", &n_network_retries); + (void) g_variant_lookup (options, "n-network-retries", "u", &n_network_retries); } if (!ostree_repo_remote_get_gpg_verify_summary (self, name, &gpg_verify_summary, error)) From 2e9db809b9675585296ef410d5af4d84f9074101 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 16 Sep 2020 15:54:03 +0200 Subject: [PATCH 3/3] signatures: Fix leak in _sign_detached_metadata_append() This needs to ref_sink the returned variant, as it is used with g_autoptr in the callers. --- src/libostree/ostree-sign.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libostree/ostree-sign.c b/src/libostree/ostree-sign.c index ee7e928d..eeef96dd 100644 --- a/src/libostree/ostree-sign.c +++ b/src/libostree/ostree-sign.c @@ -365,7 +365,7 @@ _sign_detached_metadata_append (OstreeSign *self, signature_key, g_variant_builder_end (signature_builder)); - return g_variant_dict_end (&metadata_dict); + return g_variant_ref_sink (g_variant_dict_end (&metadata_dict)); } /**