summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-10 21:17:37 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-10 23:41:03 +0200
commit72673e866a83e6aafdbb599eb3eff2617b7dc79d (patch)
tree4c89da2e758fefcfd2f17f0a66244af53cec0a1d /src/core/unit.c
parentb9316fb0f39fff3df792e4e72eb491ec4265b91f (diff)
unit: when deserializing cgroup path add it back into cgroup hashmap
Also, properly remove cgroup path from hashmap when freeing unit.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 70cdd3d943..5bc57e25c6 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -433,7 +433,11 @@ void unit_free(Unit *u) {
if (u->in_cgroup_queue)
LIST_REMOVE(Unit, cgroup_queue, u->manager->cgroup_queue, u);
- free(u->cgroup_path);
+ if (u->cgroup_path) {
+ hashmap_remove(u->manager->cgroup_unit, u->cgroup_path);
+ free(u->cgroup_path);
+ }
+
free(u->description);
strv_free(u->documentation);
free(u->fragment_path);
@@ -2308,6 +2312,8 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
free(u->cgroup_path);
u->cgroup_path = s;
+
+ hashmap_put(u->manager->cgroup_unit, s, u);
continue;
}