mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
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:
parent
552b815365
commit
387ed239e2
@ -457,7 +457,6 @@ gsettings_set (GSettings *settings,
|
|||||||
|
|
||||||
existing = g_settings_get_value (settings, key);
|
existing = g_settings_get_value (settings, key);
|
||||||
type = g_variant_get_type (existing);
|
type = g_variant_get_type (existing);
|
||||||
g_variant_unref (existing);
|
|
||||||
|
|
||||||
new = g_variant_parse (type, value, NULL, NULL, &error);
|
new = g_variant_parse (type, value, NULL, NULL, &error);
|
||||||
|
|
||||||
@ -490,6 +489,9 @@ gsettings_set (GSettings *settings,
|
|||||||
new = g_variant_new_string (value);
|
new = g_variant_new_string (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we're done with 'type' now, so we can free 'existing' */
|
||||||
|
g_variant_unref (existing);
|
||||||
|
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
{
|
{
|
||||||
g_printerr ("%s\n", error->message);
|
g_printerr ("%s\n", error->message);
|
||||||
|
Loading…
Reference in New Issue
Block a user