mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-07 06:03:51 +00:00
sysv-generator: fix memory leak on failure
This fixes a memory leak introduced by1ed0c19f81(cherry picked from commitb3fae863ef)
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
63e1555696
commit
852efd7179
@@ -760,13 +760,11 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
|
||||
service->name = name;
|
||||
service->path = fpath;
|
||||
|
||||
r = load_sysv(service);
|
||||
if (r < 0)
|
||||
continue;
|
||||
|
||||
r = hashmap_put(all_services, service->name, service);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
free(service);
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
name = fpath = NULL;
|
||||
}
|
||||
@@ -947,6 +945,12 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
HASHMAP_FOREACH(service, all_services, j) {
|
||||
q = load_sysv(service);
|
||||
if (q < 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
HASHMAP_FOREACH(service, all_services, j) {
|
||||
q = fix_order(service, all_services);
|
||||
if (q < 0)
|
||||
|
||||
Reference in New Issue
Block a user