summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2024-11-21 01:53:20 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-11-21 06:02:34 +0100
commitb7eefa1996f33f29b32bc9e5f20f4e70fa22a14a (patch)
tree9c27b62b805a744f2532cac8d005831a96bf9f41 /src
parentnetwork: update state files before replying bus method (#35255) (diff)
downloadsystemd-b7eefa1996f33f29b32bc9e5f20f4e70fa22a14a.tar.xz
systemd-b7eefa1996f33f29b32bc9e5f20f4e70fa22a14a.zip
cgroup-util: fix memory leak on error
CID#1565824 Follow-up for f6793bbcf0e3f0a6daa77add96183b88d5ec2117
Diffstat (limited to 'src')
-rw-r--r--src/basic/cgroup-util.c4
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;
}
}