]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
login: fix use after free
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 2 Sep 2019 16:55:46 +0000 (01:55 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Sep 2019 07:40:31 +0000 (09:40 +0200)
id is basename(state_file)

src/login/logind-inhibit.c

index 1883c97e4db21cc46175b1ad76e9782afa76543d..67fe9921d4019385f844d9a4da092f53b3388511 100644 (file)
@@ -72,13 +72,13 @@ Inhibitor* inhibitor_free(Inhibitor *i) {
         sd_event_source_unref(i->event_source);
         safe_close(i->fifo_fd);
 
+        hashmap_remove(i->manager->inhibitors, i->id);
+
         /* Note that we don't remove neither the state file nor the fifo path here, since we want both to
          * survive daemon restarts */
         free(i->state_file);
         free(i->fifo_path);
 
-        hashmap_remove(i->manager->inhibitors, i->id);
-
         return mfree(i);
 }