mirror of
https://github.com/systemd/systemd.git
synced 2024-11-26 19:53:45 +08:00
cgroup-util: fix memory leak on error
CID#1565824
Follow-up for f6793bbcf0
This commit is contained in:
parent
2e5b0412f9
commit
b7eefa1996
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user