Blob Blame History Raw
From 34238a9e845455ae2b92159c71b75b7abedc2eb9 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 18 Jun 2018 12:33:42 +0200
Subject: [PATCH 05/51] manager: avoid leaking session_id

get_login_window_session_id() duplicates the session id.
---
 daemon/gdm-manager.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index a9d5628ea..71f55ec65 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1449,60 +1449,61 @@ get_login_window_session_id (const char  *seat_id,
 
                 free (service_id);
         }
 
         *session_id = NULL;
         ret = FALSE;
 
 out:
         if (sessions) {
                 for (i = 0; sessions[i]; i ++) {
                         free (sessions[i]);
                 }
 
                 free (sessions);
         }
 
         return ret;
 }
 
 static void
 activate_login_window_session_on_seat (GdmManager *self,
                                        const char *seat_id)
 {
         char *session_id;
 
         if (!get_login_window_session_id (seat_id, &session_id)) {
                 return;
         }
 
         activate_session_id (self, seat_id, session_id);
+        g_free (session_id);
 }
 
 static void
 maybe_activate_other_session (GdmManager *self,
                               GdmDisplay *old_display)
 {
         char *seat_id = NULL;
         char *session_id;
         int ret;
 
         g_object_get (G_OBJECT (old_display),
                       "seat-id", &seat_id,
                       NULL);
 
         ret = sd_seat_get_active (seat_id, &session_id, NULL);
 
         if (ret == 0) {
                 GdmDisplay *display;
 
                 display = gdm_display_store_find (self->priv->display_store,
                                                   lookup_by_session_id,
                                                   (gpointer) session_id);
 
                 if (display == NULL) {
                         activate_login_window_session_on_seat (self, seat_id);
                 }
         }
 
         g_free (seat_id);
 }
-- 
2.27.0