1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-11 04:58:19 +03:00

process-util: Fix memory leak

This commit is contained in:
Daan De Meyer 2021-12-09 15:46:13 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent e63fa0756c
commit 1f013e0c49

View File

@ -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)