Blame SOURCES/fix-leak.patch

7f2946
From cfee906f39afa58d883e4fbed1888274c79c6e30 Mon Sep 17 00:00:00 2001
7f2946
From: Ray Strode <rstrode@redhat.com>
7f2946
Date: Wed, 29 Jan 2014 10:29:04 -0500
7f2946
Subject: [PATCH] user: fix memory leak in save_extra_data function
7f2946
7f2946
The save_extra_data function serializes a key file
7f2946
assocated with the user to disk.
7f2946
7f2946
It fails to free the in memory buffer, however.
7f2946
7f2946
This commit fixes that.
7f2946
7f2946
see downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=1003033
7f2946
---
7f2946
 src/user.c | 1 +
7f2946
 1 file changed, 1 insertion(+)
7f2946
7f2946
diff --git a/src/user.c b/src/user.c
7f2946
index 163d136..de30090 100644
7f2946
--- a/src/user.c
7f2946
+++ b/src/user.c
7f2946
@@ -407,60 +407,61 @@ user_save_to_keyfile (User     *user,
7f2946
 
7f2946
         if (user->location)
7f2946
                 g_key_file_set_string (keyfile, "User", "Location", user->location);
7f2946
 
7f2946
         if (user->password_hint)
7f2946
                 g_key_file_set_string (keyfile, "User", "PasswordHint", user->password_hint);
7f2946
 
7f2946
         if (user->icon_file)
7f2946
                 g_key_file_set_string (keyfile, "User", "Icon", user->icon_file);
7f2946
 
7f2946
         g_key_file_set_boolean (keyfile, "User", "SystemAccount", user->system_account);
7f2946
 }
7f2946
 
7f2946
 static void
7f2946
 save_extra_data (User *user)
7f2946
 {
7f2946
         gchar *filename;
7f2946
         gchar *data;
7f2946
         GError *error;
7f2946
 
7f2946
         user_save_to_keyfile (user, user->keyfile);
7f2946
 
7f2946
         error = NULL;
7f2946
         data = g_key_file_to_data (user->keyfile, NULL, &error);
7f2946
         if (error == NULL) {
7f2946
                 filename = g_build_filename (USERDIR,
7f2946
                                              user->user_name,
7f2946
                                              NULL);
7f2946
                 g_file_set_contents (filename, data, -1, &error);
7f2946
                 g_free (filename);
7f2946
+                g_free (data);
7f2946
         }
7f2946
         if (error) {
7f2946
                 g_warning ("Saving data for user %s failed: %s",
7f2946
                            user->user_name, error->message);
7f2946
                 g_error_free (error);
7f2946
         }
7f2946
 }
7f2946
 
7f2946
 static void
7f2946
 move_extra_data (const gchar *old_name,
7f2946
                  const gchar *new_name)
7f2946
 {
7f2946
         gchar *old_filename;
7f2946
         gchar *new_filename;
7f2946
 
7f2946
         old_filename = g_build_filename (USERDIR,
7f2946
                                          old_name, NULL);
7f2946
         new_filename = g_build_filename (USERDIR,
7f2946
                                          new_name, NULL);
7f2946
 
7f2946
         g_rename (old_filename, new_filename);
7f2946
 
7f2946
         g_free (old_filename);
7f2946
         g_free (new_filename);
7f2946
 }
7f2946
 
7f2946
 static gchar *
7f2946
 compute_object_path (User *user)
7f2946
 {
7f2946
         gchar *object_path;
7f2946
-- 
7f2946
1.8.4.2
7f2946