dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 13f493dc9ace9861c1f27c4d37e8cd6d52fe6a32 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Sun, 31 Aug 2014 23:34:01 +0200
Subject: [PATCH] login: fix mem leak

---
 src/login/logind-session.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 0c6e425603..58453b516f 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -1114,8 +1114,10 @@ int session_set_controller(Session *s, const char *sender, bool force) {
          * If logind crashes/restarts, we restore the controller during restart
          * or reset the VT in case it crashed/exited, too. */
         r = session_prepare_vt(s);
-        if (r < 0)
+        if (r < 0) {
+                free(t);
                 return r;
+        }
 
         session_swap_controller(s, t);