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:
parent
e63fa0756c
commit
1f013e0c49
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user