gsettings tool: fix a memory error

8852d4e9a0 introduced a memory error by
taking the type of a GVariant, freeing the GVariant and using the type
after the free.

This delays the free until after we've used the type.

https://bugzilla.gnome.org/show_bug.cgi?id=669253
This commit is contained in:
Ryan Lortie 2012-02-02 10:48:11 -05:00
parent 552b815365
commit 387ed239e2

View File

@ -457,7 +457,6 @@ gsettings_set (GSettings *settings,
existing = g_settings_get_value (settings, key);
type = g_variant_get_type (existing);
g_variant_unref (existing);
new = g_variant_parse (type, value, NULL, NULL, &error);
@ -490,6 +489,9 @@ gsettings_set (GSettings *settings,
new = g_variant_new_string (value);
}
/* we're done with 'type' now, so we can free 'existing' */
g_variant_unref (existing);
if (new == NULL)
{
g_printerr ("%s\n", error->message);