From a4f82d2cd7be87f4f23b86dd683ce89b34841cd9 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 18 Dec 2022 10:51:36 +0000 Subject: [PATCH 1/2] journal-remote: fix initialization of vacuum metrics Follow-up for f12b399dd6362a03379cb769954ebfb9972236ed from https://github.com/systemd/systemd/pull/25076 CID#1501551 --- src/journal-remote/journal-remote-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c index 476c9ad972c..29f05891f57 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c @@ -1148,7 +1148,7 @@ static int run(int argc, char **argv) { journal_reset_metrics(&s.metrics); s.metrics.max_use = arg_max_use; s.metrics.max_size = arg_max_size; - s.metrics.max_size = arg_keep_free; + s.metrics.keep_free = arg_keep_free; s.metrics.n_max_files = arg_n_max_files; r = create_remoteserver(&s, key, cert, trust); From 4bf277caa54ed2b1cab474b5e38c3675eb5ada3a Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 18 Dec 2022 10:58:37 +0000 Subject: [PATCH 2/2] journal-remote: fix memory leak on initialization error Follow-up for f12b399dd6362a03379cb769954ebfb9972236ed from https://github.com/systemd/systemd/pull/25076 CID#1501550 --- src/journal-remote/journal-remote-write.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/journal-remote/journal-remote-write.c b/src/journal-remote/journal-remote-write.c index 2e58c6d91ee..f6c3d83732b 100644 --- a/src/journal-remote/journal-remote-write.c +++ b/src/journal-remote/journal-remote-write.c @@ -22,7 +22,7 @@ static int do_rotate(ManagedJournalFile **f, MMapCache *m, JournalFileFlags file } Writer* writer_new(RemoteServer *server) { - Writer *w; + _cleanup_(writer_unrefp) Writer *w = NULL; int r; w = new0(Writer, 1); @@ -33,7 +33,7 @@ Writer* writer_new(RemoteServer *server) { w->mmap = mmap_cache_new(); if (!w->mmap) - return mfree(w); + return NULL; w->n_ref = 1; w->server = server; @@ -50,7 +50,7 @@ Writer* writer_new(RemoteServer *server) { } } - return w; + return TAKE_PTR(w); } static Writer* writer_free(Writer *w) {