Blame SOURCES/0005-manager-avoid-leaking-session_id.patch

a1b388
From 34238a9e845455ae2b92159c71b75b7abedc2eb9 Mon Sep 17 00:00:00 2001
a1b388
From: Lubomir Rintel <lkundrak@v3.sk>
a1b388
Date: Mon, 18 Jun 2018 12:33:42 +0200
a1b388
Subject: [PATCH 05/51] manager: avoid leaking session_id
a1b388
a1b388
get_login_window_session_id() duplicates the session id.
a1b388
---
a1b388
 daemon/gdm-manager.c | 1 +
a1b388
 1 file changed, 1 insertion(+)
a1b388
a1b388
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
a1b388
index a9d5628ea..71f55ec65 100644
a1b388
--- a/daemon/gdm-manager.c
a1b388
+++ b/daemon/gdm-manager.c
a1b388
@@ -1449,60 +1449,61 @@ get_login_window_session_id (const char  *seat_id,
a1b388
 
a1b388
                 free (service_id);
a1b388
         }
a1b388
 
a1b388
         *session_id = NULL;
a1b388
         ret = FALSE;
a1b388
 
a1b388
 out:
a1b388
         if (sessions) {
a1b388
                 for (i = 0; sessions[i]; i ++) {
a1b388
                         free (sessions[i]);
a1b388
                 }
a1b388
 
a1b388
                 free (sessions);
a1b388
         }
a1b388
 
a1b388
         return ret;
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 activate_login_window_session_on_seat (GdmManager *self,
a1b388
                                        const char *seat_id)
a1b388
 {
a1b388
         char *session_id;
a1b388
 
a1b388
         if (!get_login_window_session_id (seat_id, &session_id)) {
a1b388
                 return;
a1b388
         }
a1b388
 
a1b388
         activate_session_id (self, seat_id, session_id);
a1b388
+        g_free (session_id);
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 maybe_activate_other_session (GdmManager *self,
a1b388
                               GdmDisplay *old_display)
a1b388
 {
a1b388
         char *seat_id = NULL;
a1b388
         char *session_id;
a1b388
         int ret;
a1b388
 
a1b388
         g_object_get (G_OBJECT (old_display),
a1b388
                       "seat-id", &seat_id,
a1b388
                       NULL);
a1b388
 
a1b388
         ret = sd_seat_get_active (seat_id, &session_id, NULL);
a1b388
 
a1b388
         if (ret == 0) {
a1b388
                 GdmDisplay *display;
a1b388
 
a1b388
                 display = gdm_display_store_find (self->priv->display_store,
a1b388
                                                   lookup_by_session_id,
a1b388
                                                   (gpointer) session_id);
a1b388
 
a1b388
                 if (display == NULL) {
a1b388
                         activate_login_window_session_on_seat (self, seat_id);
a1b388
                 }
a1b388
         }
a1b388
 
a1b388
         g_free (seat_id);
a1b388
 }
a1b388
-- 
a1b388
2.27.0
a1b388