[gnome-initial-setup] driver: duplicate password/user object



commit 2842336c1607059a9632055e446a5116664a6492
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jul 27 16:31:58 2015 -0400

    driver: duplicate password/user object
    
    The driver needs to hold an internal copy of the password,
    so the password isn't freed at an inopportune moment.
    
    For symmetry, this commit also takes a reference on the
    user object that is passed at the same time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752980

 gnome-initial-setup/gis-driver.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index 449745b..7eb9c9a 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -69,7 +69,7 @@ struct _GisDriverPrivate {
   GisAssistant *assistant;
 
   ActUser *user_account;
-  const gchar *user_password;
+  gchar *user_password;
 
   gchar *lang_id;
   gchar *username;
@@ -89,6 +89,9 @@ gis_driver_finalize (GObject *object)
 
   g_free (priv->lang_id);
   g_free (priv->username);
+  g_free (priv->user_password);
+
+  g_clear_object (&priv->user_account);
 
   G_OBJECT_CLASS (gis_driver_parent_class)->finalize (object);
 }
@@ -180,8 +183,8 @@ gis_driver_set_user_permissions (GisDriver   *driver,
                                  const gchar *password)
 {
   GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
-  priv->user_account = user;
-  priv->user_password = password;
+  g_set_object (&priv->user_account, user);
+  priv->user_password = g_strdup (password);
 }
 
 void


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