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

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