]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
fix some memory leaks
authorMichael Terry <michael.terry@canonical.com>
Wed, 25 Apr 2012 17:03:04 +0000 (13:03 -0400)
committerMichael Terry <michael.terry@canonical.com>
Wed, 25 Apr 2012 17:03:04 +0000 (13:03 -0400)
liblightdm-gobject/session.c
liblightdm-gobject/user.c

index 3ebb8ce49dff49e65403546ca620a56671ad1788..ffd55caef68ad8d53a356df56bd5d758c0488304 100644 (file)
@@ -78,6 +78,7 @@ load_session (GKeyFile *key_file, const gchar *key)
 
         if (!full_path)
         {
+            g_free (name);
             g_free (domain);
             return NULL;
         }
@@ -265,6 +266,17 @@ lightdm_session_get_property (GObject    *object,
     }
 }
 
+static void
+lightdm_session_finalize (GObject *object)
+{
+    LightDMSession *self = LIGHTDM_SESSION (object);
+    LightDMSessionPrivate *priv = GET_PRIVATE (self);
+
+    g_free (priv->key);
+    g_free (priv->name);
+    g_free (priv->comment);
+}
+
 static void
 lightdm_session_class_init (LightDMSessionClass *klass)
 {
@@ -274,6 +286,7 @@ lightdm_session_class_init (LightDMSessionClass *klass)
 
     object_class->set_property = lightdm_session_set_property;
     object_class->get_property = lightdm_session_get_property;
+    object_class->finalize = lightdm_session_finalize;
 
     g_object_class_install_property (object_class,
                                      PROP_KEY,
index f531a560861d142fe043e59353ec6ce0f14df2d2..a21b69f89390392d8cfab046d4bef1ae05f7288c 100644 (file)
@@ -1120,7 +1120,8 @@ load_dmrc (LightDMUser *user)
     gchar *path;
     //gboolean have_dmrc;
 
-    priv->dmrc_file = g_key_file_new ();
+    if (!priv->dmrc_file)
+        priv->dmrc_file = g_key_file_new ();
 
     /* Load from the user directory */  
     path = g_build_filename (priv->home_directory, ".dmrc", NULL);