Blame SOURCES/0002-lib-leak-fix.patch

baf615
From bb381997525a1ff74f1bbac3556d566b62f3ef1b Mon Sep 17 00:00:00 2001
baf615
From: Ray Strode <rstrode@redhat.com>
baf615
Date: Wed, 27 Sep 2017 10:41:47 -0400
baf615
Subject: [PATCH 02/13] lib: leak fix
baf615
baf615
If a new user is added by accounts service, we currently leak
baf615
a reference to it. That leads to transient user objects living
baf615
longer than they're supposed which uses memory and produces
baf615
excess bus traffic.
baf615
---
baf615
 src/libaccountsservice/act-user-manager.c | 5 ++++-
baf615
 1 file changed, 4 insertions(+), 1 deletion(-)
baf615
baf615
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
baf615
index d866725..c8d0443 100644
baf615
--- a/src/libaccountsservice/act-user-manager.c
baf615
+++ b/src/libaccountsservice/act-user-manager.c
baf615
@@ -1088,68 +1088,71 @@ add_new_user_for_object_path (const char     *object_path,
baf615
         user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
baf615
 
baf615
         if (user != NULL) {
baf615
                 g_debug ("ActUserManager: tracking existing %s with object path %s",
baf615
                          describe_user (user), object_path);
baf615
                 return user;
baf615
         }
baf615
 
baf615
         user = find_new_user_with_object_path (manager, object_path);
baf615
 
baf615
         if (user != NULL) {
baf615
                 g_debug ("ActUserManager: tracking existing (but very recently added) %s with object path %s",
baf615
                          describe_user (user), object_path);
baf615
                 return user;
baf615
         }
baf615
 
baf615
         g_debug ("ActUserManager: tracking new user with object path %s", object_path);
baf615
 
baf615
         user = create_new_user (manager);
baf615
         _act_user_update_from_object_path (user, object_path);
baf615
 
baf615
         return user;
baf615
 }
baf615
 
baf615
 static void
baf615
 on_new_user_in_accounts_service (GDBusProxy *proxy,
baf615
                                  const char *object_path,
baf615
                                  gpointer    user_data)
baf615
 {
baf615
         ActUserManager *manager = ACT_USER_MANAGER (user_data);
baf615
+        ActUser *user;
baf615
 
baf615
         if (!manager->priv->is_loaded) {
baf615
                 g_debug ("ActUserManager: ignoring new user in accounts service with object path %s since not loaded yet", object_path);
baf615
                 return;
baf615
         }
baf615
 
baf615
         g_debug ("ActUserManager: new user in accounts service with object path %s", object_path);
baf615
-        add_new_user_for_object_path (object_path, manager);
baf615
+        user = add_new_user_for_object_path (object_path, manager);
baf615
+
baf615
+        g_object_unref (user);
baf615
 }
baf615
 
baf615
 static void
baf615
 on_user_removed_in_accounts_service (GDBusProxy *proxy,
baf615
                                      const char *object_path,
baf615
                                      gpointer    user_data)
baf615
 {
baf615
         ActUserManager *manager = ACT_USER_MANAGER (user_data);
baf615
         ActUser        *user;
baf615
 
baf615
         user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
baf615
 
baf615
         if (user == NULL) {
baf615
                 g_debug ("ActUserManager: ignoring untracked user %s", object_path);
baf615
                 return;
baf615
         } else {
baf615
                 g_debug ("ActUserManager: tracked user %s removed from accounts service", object_path);
baf615
         }
baf615
 
baf615
         manager->priv->new_users = g_slist_remove (manager->priv->new_users, user);
baf615
 
baf615
         remove_user (manager, user);
baf615
 }
baf615
 
baf615
 static void
baf615
 on_get_current_session_finished (GObject        *object,
baf615
                                  GAsyncResult   *result,
baf615
                                  gpointer        data)
baf615
 {
baf615
         ConsoleKitManager *proxy = CONSOLE_KIT_MANAGER (object);
baf615
-- 
baf615
2.14.1
baf615