|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 60240797a4ce464ec7a0537ccbec4c83f599251c Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: David Herrmann <dh.herrmann@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Fri, 22 Aug 2014 14:57:11 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] login: fix memory-leak on DropController()
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Our bus-name watch helpers only remove a bus-name if it's not a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
controller, anymore. If we call manager_drop_busname() before
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unregistering the controller, the busname will not be dropped. Therefore,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
first drop the controller, then drop the bus-name.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/login/logind-session.c | 6 ++++--
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 136bbce78e..0c6e425603 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/login/logind-session.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/login/logind-session.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1061,11 +1061,13 @@ bool session_is_controller(Session *s, const char *sender) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void session_swap_controller(Session *s, char *name) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
SessionDevice *sd;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ char *c;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->controller) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- manager_drop_busname(s->manager, s->controller);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- free(s->controller);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ c = s->controller;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->controller = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ manager_drop_busname(s->manager, c);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ free(c);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* Drop all devices as they're now unused. Do that after the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* controller is released to avoid sending out useles
|