mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
unit-name: fix memory leak
Fix a memory leak introduced by 2fc09a9c. 's' is used twice in this
function, and if free_and_strdup() fails, the pointer is left untouched.
This commit is contained in:
@@ -695,8 +695,10 @@ int slice_build_parent_slice(const char *slice, char **ret) {
|
||||
strcpy(dash, ".slice");
|
||||
else {
|
||||
r = free_and_strdup(&s, "-.slice");
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
free(s);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
*ret = s;
|
||||
|
||||
Reference in New Issue
Block a user