diff --git a/21705.patch b/21705.patch new file mode 100644 index 0000000..51d5714 --- /dev/null +++ b/21705.patch @@ -0,0 +1,29 @@ +From ca52de3b56d5e70232bee29314cd84f5596c1e7f Mon Sep 17 00:00:00 2001 +From: Daan De Meyer +Date: Thu, 9 Dec 2021 15:46:13 +0100 +Subject: [PATCH] process-util: Fix memory leak + +--- + src/basic/process-util.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/basic/process-util.c b/src/basic/process-util.c +index 1b96d3ca8543..c97185215847 100644 +--- a/src/basic/process-util.c ++++ b/src/basic/process-util.c +@@ -221,9 +221,12 @@ int get_process_cmdline(pid_t pid, size_t max_columns, ProcessCmdlineFlags flags + return -ENOMEM; + + /* Drop trailing empty strings. See issue #21186. */ +- STRV_FOREACH_BACKWARDS(p, args) +- if (isempty(*p)) +- *p = mfree(*p); ++ STRV_FOREACH_BACKWARDS(p, args) { ++ if (!isempty(*p)) ++ break; ++ ++ *p = mfree(*p); ++ } + + ans = quote_command_line(args, shflags); + if (!ans) diff --git a/systemd.spec b/systemd.spec index 309d7fe..2a0ba01 100644 --- a/systemd.spec +++ b/systemd.spec @@ -92,6 +92,7 @@ GIT_DIR=../../src/systemd/.git git diffab -M v233..master@{2017-06-15} -- hwdb/[ # here, rather than in the next section. Packit CI will drop any # patches in this range before applying upstream pull requests. +Patch0001: https://github.com/systemd/systemd/pull/21705.patch # Downstream-only patches (5000–9999) # https://bugzilla.redhat.com/show_bug.cgi?id=1738828