From: Yu Watanabe Date: Mon, 2 Sep 2019 16:55:46 +0000 (+0900) Subject: login: fix use after free X-Git-Tag: v243~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0917293072189299f3b85a42e50551b584d37ccb;p=thirdparty%2Fsystemd.git login: fix use after free id is basename(state_file) --- diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 1883c97e4db..67fe9921d40 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); }