Author: jannis
Date: 2008-07-17 14:40:16 +0000 (Thu, 17 Jul 2008)
New Revision: 27327

Modified:
   xfconf/trunk/xfsettingsd/registry.c
Log:
xfsettingsd/registry.c: Fix memory leaks and a crash due to invalid
free'ing of a GError (use g_error_free instead of g_free).

Modified: xfconf/trunk/xfsettingsd/registry.c
===================================================================
--- xfconf/trunk/xfsettingsd/registry.c 2008-07-17 13:49:30 UTC (rev 27326)
+++ xfconf/trunk/xfsettingsd/registry.c 2008-07-17 14:40:16 UTC (rev 27327)
@@ -371,7 +371,7 @@
     
     /* print warning */
     g_critical ("Failed to spawn xrdb: %s", error->message);
-    g_free (error);
+    g_error_free (error);
 }
 
 void
@@ -533,6 +533,8 @@
                     8, PropModeReplace, buffer, buf_len);
 
     registry->priv->last_change_serial = registry->priv->serial;
+
+    g_free (buffer);
 }
 
 XSettingsRegistry *
@@ -703,6 +705,7 @@
 {
     XfconfChannel *channel = registry->priv->channel;
     XSettingsRegistryEntry *entry = properties;
+    gchar *str;
 
     while (entry->name)
     {
@@ -717,7 +720,9 @@
                     g_value_set_int(&entry->value, 
xfconf_channel_get_int(channel, name, g_value_get_int(&entry->value)));
                     break;
                 case G_TYPE_STRING:
-                    g_value_set_string(&entry->value, 
xfconf_channel_get_string(channel, name, g_value_get_string(&entry->value)));
+                    str = xfconf_channel_get_string(channel, name, 
g_value_get_string(&entry->value));
+                    g_value_set_string(&entry->value, str);
+                    g_free(str);
                     break;
                 case G_TYPE_BOOLEAN:
                     g_value_set_boolean(&entry->value, 
xfconf_channel_get_bool(channel, name, g_value_get_boolean(&entry->value)));

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to