Blame SOURCES/0001-manager-plug-leak-in-maybe_activate_other_session.patch

795d2c
From 82006d15b70842d2b1ad7d47d9490e315436cb5f Mon Sep 17 00:00:00 2001
795d2c
From: Ray Strode <rstrode@redhat.com>
795d2c
Date: Fri, 22 Jun 2018 14:44:11 -0400
f62751
Subject: [PATCH 1/7] manager: plug leak in maybe_activate_other_session
795d2c
795d2c
The function asks logind what the currently active session is on the
795d2c
given seat.  It then leaks the response.
795d2c
795d2c
This commit plugs the leak.
795d2c
---
795d2c
 daemon/gdm-manager.c | 4 +++-
795d2c
 1 file changed, 3 insertions(+), 1 deletion(-)
795d2c
795d2c
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
795d2c
index 7539acf11..129cc0de4 100644
795d2c
--- a/daemon/gdm-manager.c
795d2c
+++ b/daemon/gdm-manager.c
795d2c
@@ -1394,79 +1394,81 @@ get_login_window_session_id (const char  *seat_id,
795d2c
 out:
795d2c
         if (sessions) {
795d2c
                 for (i = 0; sessions[i]; i ++) {
795d2c
                         free (sessions[i]);
795d2c
                 }
795d2c
 
795d2c
                 free (sessions);
795d2c
         }
795d2c
 
795d2c
         return ret;
795d2c
 }
795d2c
 
795d2c
 static void
795d2c
 activate_login_window_session_on_seat (GdmManager *self,
795d2c
                                        const char *seat_id)
795d2c
 {
795d2c
         char *session_id;
795d2c
 
795d2c
         if (!get_login_window_session_id (seat_id, &session_id)) {
795d2c
                 return;
795d2c
         }
795d2c
 
795d2c
         activate_session_id (self, seat_id, session_id);
795d2c
 }
795d2c
 
795d2c
 static void
795d2c
 maybe_activate_other_session (GdmManager *self,
795d2c
                               GdmDisplay *old_display)
795d2c
 {
795d2c
         char *seat_id = NULL;
795d2c
-        char *session_id;
795d2c
+        char *session_id = NULL;
795d2c
         int ret;
795d2c
 
795d2c
         g_object_get (G_OBJECT (old_display),
795d2c
                       "seat-id", &seat_id,
795d2c
                       NULL);
795d2c
 
795d2c
         ret = sd_seat_get_active (seat_id, &session_id, NULL);
795d2c
 
795d2c
         if (ret == 0) {
795d2c
                 GdmDisplay *display;
795d2c
 
795d2c
                 display = gdm_display_store_find (self->priv->display_store,
795d2c
                                                   lookup_by_session_id,
795d2c
                                                   (gpointer) session_id);
795d2c
 
795d2c
                 if (display == NULL) {
795d2c
                         activate_login_window_session_on_seat (self, seat_id);
795d2c
                 }
795d2c
+
795d2c
+                g_free (session_id);
795d2c
         }
795d2c
 
795d2c
         g_free (seat_id);
795d2c
 }
795d2c
 
795d2c
 static const char *
795d2c
 get_username_for_greeter_display (GdmManager *manager,
795d2c
                                   GdmDisplay *display)
795d2c
 {
795d2c
         gboolean doing_initial_setup = FALSE;
795d2c
 
795d2c
         g_object_get (G_OBJECT (display),
795d2c
                       "doing-initial-setup", &doing_initial_setup,
795d2c
                       NULL);
795d2c
 
795d2c
         if (doing_initial_setup) {
795d2c
                 return INITIAL_SETUP_USERNAME;
795d2c
         } else {
795d2c
                 return GDM_USERNAME;
795d2c
         }
795d2c
 }
795d2c
 
795d2c
 static void
795d2c
 set_up_automatic_login_session (GdmManager *manager,
795d2c
                                 GdmDisplay *display)
795d2c
 {
795d2c
         GdmSession *session;
795d2c
         char       *display_session_type = NULL;
795d2c
         gboolean is_initial;
795d2c
 
795d2c
-- 
795d2c
2.19.0
795d2c