1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00

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.
This commit is contained in:
David Herrmann 2014-08-22 14:57:11 +02:00
parent fb835651af
commit 60240797a4
Notes: Lennart Poettering 2014-10-24 17:31:23 +02:00
Backport: bugfix

View File

@ -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