summaryrefslogtreecommitdiff
path: root/src/machine/machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/machine/machine.c')
-rw-r--r--src/machine/machine.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c
index a33a111043..cf3ef15456 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -85,6 +85,9 @@ void machine_free(Machine *m) {
hashmap_remove(m->manager->machines, m->name);
+ if (m->leader > 0)
+ hashmap_remove_value(m->manager->machine_leaders, UINT_TO_PTR(m->leader), m);
+
sd_bus_message_unref(m->create_message);
free(m->name);
@@ -263,6 +266,10 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) {
if (m->started)
return 0;
+ r = hashmap_put(m->manager->machine_leaders, UINT_TO_PTR(m->leader), m);
+ if (r < 0)
+ return r;
+
/* Create cgroup */
r = machine_start_scope(m, properties, error);
if (r < 0)