]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/login/logind.c
logind: switch sessions_by_leader to PidRef
[thirdparty/systemd.git] / src / login / logind.c
index 0e85bffe2bd9f38d1f6ccd5973a03464a9d4d181..88e05bb769c0c44f618ab6660aff6b75403d5786 100644 (file)
@@ -70,7 +70,6 @@ static int manager_new(Manager **ret) {
         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);
@@ -78,7 +77,7 @@ static int manager_new(Manager **ret) {
         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);
@@ -116,7 +115,11 @@ static Manager* manager_free(Manager *m) {
         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);