diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2024-11-21 01:53:20 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-21 06:02:34 +0100 |
commit | b7eefa1996f33f29b32bc9e5f20f4e70fa22a14a (patch) | |
tree | 9c27b62b805a744f2532cac8d005831a96bf9f41 /src/basic | |
parent | network: update state files before replying bus method (#35255) (diff) | |
download | systemd-b7eefa1996f33f29b32bc9e5f20f4e70fa22a14a.tar.xz systemd-b7eefa1996f33f29b32bc9e5f20f4e70fa22a14a.zip |
cgroup-util: fix memory leak on error
CID#1565824
Follow-up for f6793bbcf0e3f0a6daa77add96183b88d5ec2117
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/cgroup-util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 5370090f00..8b1e051d56 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -799,7 +799,7 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **ret_path) { continue; } - char *path = strdup(e + 1); + _cleanup_free_ char *path = strdup(e + 1); if (!path) return -ENOMEM; @@ -812,7 +812,7 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **ret_path) { if (e) *e = 0; - *ret_path = path; + *ret_path = TAKE_PTR(path); return 0; } } |