unit: when deserializing cgroup path add it back into cgroup hashmap
Also, properly remove cgroup path from hashmap when freeing unit.
This commit is contained in:
parent
b9316fb0f3
commit
72673e866a
|
@ -433,7 +433,11 @@ void unit_free(Unit *u) {
|
||||||
if (u->in_cgroup_queue)
|
if (u->in_cgroup_queue)
|
||||||
LIST_REMOVE(Unit, cgroup_queue, u->manager->cgroup_queue, u);
|
LIST_REMOVE(Unit, cgroup_queue, u->manager->cgroup_queue, u);
|
||||||
|
|
||||||
|
if (u->cgroup_path) {
|
||||||
|
hashmap_remove(u->manager->cgroup_unit, u->cgroup_path);
|
||||||
free(u->cgroup_path);
|
free(u->cgroup_path);
|
||||||
|
}
|
||||||
|
|
||||||
free(u->description);
|
free(u->description);
|
||||||
strv_free(u->documentation);
|
strv_free(u->documentation);
|
||||||
free(u->fragment_path);
|
free(u->fragment_path);
|
||||||
|
@ -2308,6 +2312,8 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
|
||||||
|
|
||||||
free(u->cgroup_path);
|
free(u->cgroup_path);
|
||||||
u->cgroup_path = s;
|
u->cgroup_path = s;
|
||||||
|
|
||||||
|
hashmap_put(u->manager->cgroup_unit, s, u);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue