Blame SOURCES/fix-memory-leak.patch

01018b
From a5faef330e5840f9bf46462000c41607d1194540 Mon Sep 17 00:00:00 2001
01018b
From: Ray Strode <rstrode@redhat.com>
01018b
Date: Wed, 29 Jan 2014 11:01:00 -0500
01018b
Subject: [PATCH] display: fix memory leak if AddUserAuthentication called more
01018b
 than once
01018b
01018b
Noted on downstream bug:
01018b
01018b
https://bugzilla.redhat.com/show_bug.cgi?id=1020885
01018b
---
01018b
 daemon/gdm-display.c | 9 ++++++++-
01018b
 1 file changed, 8 insertions(+), 1 deletion(-)
01018b
01018b
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
01018b
index b1adae8..352dd92 100644
01018b
--- a/daemon/gdm-display.c
01018b
+++ b/daemon/gdm-display.c
01018b
@@ -198,61 +198,68 @@ gdm_display_real_create_authority (GdmDisplay *display)
01018b
         display->priv->access_file = access_file;
01018b
 
01018b
         return TRUE;
01018b
 }
01018b
 
01018b
 gboolean
01018b
 gdm_display_create_authority (GdmDisplay *display)
01018b
 {
01018b
         gboolean ret;
01018b
 
01018b
         g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);
01018b
 
01018b
         g_object_ref (display);
01018b
         ret = GDM_DISPLAY_GET_CLASS (display)->create_authority (display);
01018b
         g_object_unref (display);
01018b
 
01018b
         return ret;
01018b
 }
01018b
 
01018b
 static gboolean
01018b
 gdm_display_real_add_user_authorization (GdmDisplay *display,
01018b
                                          const char *username,
01018b
                                          char      **filename,
01018b
                                          GError    **error)
01018b
 {
01018b
         GdmDisplayAccessFile *access_file;
01018b
         GError               *access_file_error;
01018b
         gboolean              res;
01018b
 
01018b
         g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);
01018b
-        g_return_val_if_fail (display->priv->access_file != NULL, FALSE);
01018b
+
01018b
+        if (display->priv->user_access_file != NULL) {
01018b
+                g_set_error (error,
01018b
+                             G_DBUS_ERROR,
01018b
+                             G_DBUS_ERROR_ACCESS_DENIED,
01018b
+                             "user access already assigned");
01018b
+                return FALSE;
01018b
+        }
01018b
 
01018b
         g_debug ("GdmDisplay: Adding user authorization for %s", username);
01018b
 
01018b
         access_file_error = NULL;
01018b
         access_file = _create_access_file_for_user (display,
01018b
                                                     username,
01018b
                                                     &access_file_error);
01018b
 
01018b
         if (access_file == NULL) {
01018b
                 g_propagate_error (error, access_file_error);
01018b
                 return FALSE;
01018b
         }
01018b
 
01018b
         res = gdm_display_access_file_add_display_with_cookie (access_file,
01018b
                                                                display,
01018b
                                                                display->priv->x11_cookie,
01018b
                                                                display->priv->x11_cookie_size,
01018b
                                                                &access_file_error);
01018b
         if (! res) {
01018b
                 g_debug ("GdmDisplay: Unable to add user authorization for %s: %s",
01018b
                          username,
01018b
                          access_file_error->message);
01018b
                 g_propagate_error (error, access_file_error);
01018b
                 gdm_display_access_file_close (access_file);
01018b
                 g_object_unref (access_file);
01018b
                 return FALSE;
01018b
         }
01018b
 
01018b
         *filename = gdm_display_access_file_get_path (access_file);
01018b
         display->priv->user_access_file = access_file;
01018b
-- 
01018b
1.8.4.2
01018b