From 49d54d6ca8f347a852ef8fd48e5c0bbf91cfe8fb Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 21 Nov 2022 16:34:00 +0000 Subject: [PATCH 1/2] lib/pull: Fix a small leak when a variable is reused Signed-off-by: Philip Withnall --- src/libostree/ostree-repo-pull.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 86b4358a..9412f1e1 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -4712,6 +4712,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, !load_remote_repo_config (pull_data, &remote_config, cancellable, error)) goto out; + g_clear_pointer (&remote_mode_str, g_free); if (!ot_keyfile_get_value_with_default (remote_config, "core", "mode", "bare", &remote_mode_str, error)) goto out; From c0b6cf92985ce761d2279c0fe86caef8625a089b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 21 Nov 2022 16:35:02 +0000 Subject: [PATCH 2/2] ot-builtin-pull: Fix a minor leak with progress reporting `ostree_async_progress_get_status()` returns an allocated string. Signed-off-by: Philip Withnall --- src/ostree/ot-builtin-pull-local.c | 2 +- src/ostree/ot-builtin-pull.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c index c39930af..5dfaf887 100644 --- a/src/ostree/ot-builtin-pull-local.c +++ b/src/ostree/ot-builtin-pull-local.c @@ -211,7 +211,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc if (!console.is_tty) { g_assert (progress); - const char *status = ostree_async_progress_get_status (progress); + g_autofree char *status = ostree_async_progress_get_status (progress); if (status) g_print ("%s\n", status); } diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c index 61f408eb..e6cc053b 100644 --- a/src/ostree/ot-builtin-pull.c +++ b/src/ostree/ot-builtin-pull.c @@ -389,7 +389,7 @@ ostree_builtin_pull (int argc, char **argv, OstreeCommandInvocation *invocation, if (!console.is_tty && !opt_dry_run) { g_assert (progress); - const char *status = ostree_async_progress_get_status (progress); + g_autofree char *status = ostree_async_progress_get_status (progress); if (status) g_print ("%s\n", status); }