m->devices = hashmap_new(&device_hash_ops);
m->seats = hashmap_new(&seat_hash_ops);
m->sessions = hashmap_new(&session_hash_ops);
- m->sessions_by_leader = hashmap_new(NULL);
m->users = hashmap_new(&user_hash_ops);
m->inhibitors = hashmap_new(&inhibitor_hash_ops);
m->buttons = hashmap_new(&button_hash_ops);
m->user_units = hashmap_new(&string_hash_ops);
m->session_units = hashmap_new(&string_hash_ops);
- if (!m->devices || !m->seats || !m->sessions || !m->sessions_by_leader || !m->users || !m->inhibitors || !m->buttons || !m->user_units || !m->session_units)
+ if (!m->devices || !m->seats || !m->sessions || !m->users || !m->inhibitors || !m->buttons || !m->user_units || !m->session_units)
return -ENOMEM;
r = sd_event_default(&m->event);
hashmap_free(m->devices);
hashmap_free(m->seats);
hashmap_free(m->sessions);
+
+ /* All records should have been removed by session_free */
+ assert(hashmap_isempty(m->sessions_by_leader));
hashmap_free(m->sessions_by_leader);
+
hashmap_free(m->users);
hashmap_free(m->inhibitors);
hashmap_free(m->buttons);