diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-08-22 14:57:11 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-08-27 18:42:28 +0200 |
commit | 60240797a4ce464ec7a0537ccbec4c83f599251c (patch) | |
tree | b417f3297524cd0479b3cc93379c5865594fc8cd | |
parent | fb835651aff79a1e7fc5795086c9b26e59a8e6ca (diff) |
login: fix memory-leak on DropController()
Our bus-name watch helpers only remove a bus-name if it's not a
controller, anymore. If we call manager_drop_busname() before
unregistering the controller, the busname will not be dropped. Therefore,
first drop the controller, then drop the bus-name.
-rw-r--r-- | src/login/logind-session.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 136bbce78e..0c6e425603 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -1061,11 +1061,13 @@ bool session_is_controller(Session *s, const char *sender) { static void session_swap_controller(Session *s, char *name) { SessionDevice *sd; + char *c; if (s->controller) { - manager_drop_busname(s->manager, s->controller); - free(s->controller); + c = s->controller; s->controller = NULL; + manager_drop_busname(s->manager, c); + free(c); /* Drop all devices as they're now unused. Do that after the * controller is released to avoid sending out useles |