mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-07 14:36:53 +02:00
gsettings tool: fix a memory error
8852d4e9a08e7fbc9df7fb99a54b112f5049ee19 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…
x
Reference in New Issue
Block a user