summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/unit.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 6ac359e31b..c4ed923373 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2488,10 +2488,18 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
if (!s)
return -ENOMEM;
- free(u->cgroup_path);
- u->cgroup_path = s;
+ if (u->cgroup_path) {
+ void *p;
+
+ p = hashmap_remove(u->manager->cgroup_unit, u->cgroup_path);
+ log_info("Removing cgroup_path %s from hashmap (%p)",
+ u->cgroup_path, p);
+ free(u->cgroup_path);
+ }
+ u->cgroup_path = s;
assert(hashmap_put(u->manager->cgroup_unit, s, u) == 1);
+
continue;
}