cgroup-util: fix memory leak on error

CID#1565824

Follow-up for f6793bbcf0
This commit is contained in:
Luca Boccassi 2024-11-21 00:53:20 +00:00 committed by Yu Watanabe
parent 2e5b0412f9
commit b7eefa1996

View File

@ -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;
}
}