From ddb40187c638c4df03c2d6f969f0dfab02127cdf Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 28 Nov 2016 15:17:04 +0100 Subject: [PATCH] Fix various leaks found by valgrind --- app/flatpak-builtins-build-export.c | 2 +- common/flatpak-dir.c | 2 +- common/flatpak-utils.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/flatpak-builtins-build-export.c b/app/flatpak-builtins-build-export.c index 06e3c789..b6c94013 100644 --- a/app/flatpak-builtins-build-export.c +++ b/app/flatpak-builtins-build-export.c @@ -184,7 +184,7 @@ add_file_to_mtree (GFile *file, g_autoptr(GInputStream) input = NULL; guint64 length; g_autofree guchar *child_file_csum = NULL; - char *tmp_checksum = NULL; + g_autofree char *tmp_checksum = NULL; file_info = g_file_query_info (file, "standard::size", diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index c8fd2cc5..8213440b 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -696,7 +696,7 @@ flatpak_deploy_data_get_subpaths (GVariant *deploy_data) { const char **subpaths; - g_variant_get_child (deploy_data, 2, "^as", &subpaths); + g_variant_get_child (deploy_data, 2, "^a&s", &subpaths); return subpaths; } diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 8e61e7a3..e9b4055b 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -2443,7 +2443,7 @@ _flatpak_repo_collect_sizes (OstreeRepo *repo, { g_autoptr(GFileEnumerator) dir_enum = NULL; GFileInfo *child_info_tmp; - GError *temp_error = NULL; + g_autoptr(GError) temp_error = NULL; if (file_info != NULL && g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR) { @@ -2587,6 +2587,7 @@ flatpak_repo_update (OstreeRepo *repo, g_autofree char *title = NULL; g_autofree char *default_branch = NULL; g_autoptr(GVariant) old_summary = NULL; + g_autoptr(GVariant) new_summary = NULL; g_autoptr(GHashTable) refs = NULL; const char *prefixes[] = { "appstream", "app", "runtime", NULL }; const char **prefix; @@ -2741,8 +2742,8 @@ flatpak_repo_update (OstreeRepo *repo, g_variant_builder_add (&builder, "{sv}", "xa.cache", g_variant_new_variant (g_variant_builder_end (&ref_data_builder))); - if (!ostree_repo_regenerate_summary (repo, g_variant_builder_end (&builder), - cancellable, error)) + new_summary = g_variant_ref_sink (g_variant_builder_end (&builder)); + if (!ostree_repo_regenerate_summary (repo, new_summary, cancellable, error)) return FALSE; if (gpg_key_ids)