diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c index 993fa59e5..a232602c6 100644 --- a/gio/gsettings-tool.c +++ b/gio/gsettings-tool.c @@ -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);