summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-09-03 01:55:46 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-09-03 09:40:31 +0200
commit0917293072189299f3b85a42e50551b584d37ccb (patch)
tree8c0feaa8ffcc85dfe02ffb8aefeee916c4445573
parentc1087fdd0d4613fd9b98866eec19db43543b9754 (diff)
downloadsystemd-0917293072189299f3b85a42e50551b584d37ccb.tar.gz
login: fix use after free
id is basename(state_file)
-rw-r--r--src/login/logind-inhibit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index 1883c97e4d..67fe9921d4 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -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);
}