[gdm/wip/fix-some-fd-leaks: 1/4] manager: Don't leak session objectso




commit 35e603bed9fd36ed0c1e2c2acb47c06816772345
Author: Ray Strode <rstrode redhat com>
Date:   Fri Sep 18 15:45:20 2020 -0400

    manager: Don't leak session objectso
    
    The create_user_session_for_display function returns a new reference
    to the GdmSession object it creates.  The callers don't expect this,
    and most of the callers don't even look at the return value at all.
    
    This commit makes it return void instead.

 daemon/gdm-manager.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index e828544b..f19a6746 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -121,9 +121,9 @@ static void     gdm_manager_class_init  (GdmManagerClass *klass);
 static void     gdm_manager_init        (GdmManager      *manager);
 static void     gdm_manager_dispose     (GObject         *object);
 
-static GdmSession *create_user_session_for_display (GdmManager *manager,
-                                                    GdmDisplay *display,
-                                                    uid_t       allowed_user);
+static void     create_user_session_for_display (GdmManager *manager,
+                                                 GdmDisplay *display,
+                                                 uid_t       allowed_user);
 static void     start_user_session (GdmManager                *manager,
                                     StartUserSessionOperation *operation);
 static void     clean_user_session (GdmSession *session);
@@ -1338,7 +1338,8 @@ set_up_automatic_login_session (GdmManager *manager,
         /* 0 is root user; since the daemon talks to the session object
          * directly, itself, for automatic login
          */
-        session = create_user_session_for_display (manager, display, 0);
+        create_user_session_for_display (manager, display, 0);
+        session = get_user_session_for_display (display);
 
         g_object_get (G_OBJECT (display),
                       "session-type", &display_session_type,
@@ -2289,7 +2290,7 @@ clean_user_session (GdmSession *session)
         g_object_unref (session);
 }
 
-static GdmSession *
+static void
 create_user_session_for_display (GdmManager *manager,
                                  GdmDisplay *display,
                                  uid_t       allowed_user)
@@ -2399,7 +2400,7 @@ create_user_session_for_display (GdmManager *manager,
         g_object_set_data (G_OBJECT (session), "gdm-display", display);
         g_object_set_data_full (G_OBJECT (display),
                                 "gdm-user-session",
-                                g_object_ref (session),
+                                session,
                                 (GDestroyNotify)
                                 clean_user_session);
 
@@ -2407,8 +2408,6 @@ create_user_session_for_display (GdmManager *manager,
         greeter_is_wayland = g_strcmp0 (display_session_type, "wayland") == 0;
         g_object_set (G_OBJECT (session), "ignore-wayland", !greeter_is_wayland, NULL);
 #endif
-
-        return session;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]