mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-29 08:50:06 +02:00
Plug a mem leak
This code leaked the return value of g_variant_get_child_value(); use g_variant_get() instead and free the iter when done.
This commit is contained in:
parent
ddc94bd0a6
commit
0a7c0ac74b
@ -797,8 +797,9 @@ static void
|
|||||||
process_get_all_reply (GDBusProxy *proxy,
|
process_get_all_reply (GDBusProxy *proxy,
|
||||||
GVariant *result)
|
GVariant *result)
|
||||||
{
|
{
|
||||||
GVariantIter iter;
|
GVariantIter *iter;
|
||||||
GVariant *item;
|
gchar *key;
|
||||||
|
GVariant *value;
|
||||||
|
|
||||||
if (strcmp (g_variant_get_type_string (result), "(a{sv})") != 0)
|
if (strcmp (g_variant_get_type_string (result), "(a{sv})") != 0)
|
||||||
{
|
{
|
||||||
@ -807,22 +808,17 @@ process_get_all_reply (GDBusProxy *proxy,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_variant_iter_init (&iter, g_variant_get_child_value (result, 0));
|
g_variant_get (result, "(a{sv})", &iter);
|
||||||
while ((item = g_variant_iter_next_value (&iter)) != NULL)
|
while (g_variant_iter_next (iter, "{sv}", &key, &value))
|
||||||
{
|
{
|
||||||
gchar *key;
|
|
||||||
GVariant *value;
|
|
||||||
|
|
||||||
g_variant_get (item,
|
|
||||||
"{sv}",
|
|
||||||
&key,
|
|
||||||
&value);
|
|
||||||
//g_print ("got %s -> %s\n", key, g_variant_markup_print (value, FALSE, 0, 0));
|
//g_print ("got %s -> %s\n", key, g_variant_markup_print (value, FALSE, 0, 0));
|
||||||
|
|
||||||
g_hash_table_insert (proxy->priv->properties,
|
g_hash_table_insert (proxy->priv->properties,
|
||||||
key,
|
key, /* adopts string */
|
||||||
value); /* steals value */
|
value); /* adopts value */
|
||||||
}
|
}
|
||||||
|
g_variant_iter_free (iter);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user