mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-26 12:12:10 +01:00
gvariant: Fix memory leak on a TYPE_CHECK failure
This commit is contained in:
parent
0abf51e0de
commit
05dffc1a7f
@ -800,7 +800,13 @@ g_variant_new_array (const GVariantType *child_type,
|
||||
|
||||
for (i = 0; i < n_children; i++)
|
||||
{
|
||||
TYPE_CHECK (children[i], child_type, NULL);
|
||||
if G_UNLIKELY (!g_variant_is_of_type (children[i], child_type))
|
||||
{
|
||||
while (i != 0)
|
||||
g_variant_unref (my_children[--i]);
|
||||
g_free (my_children);
|
||||
g_return_val_if_fail (g_variant_is_of_type (children[i], child_type), NULL);
|
||||
}
|
||||
my_children[i] = g_variant_ref_sink (children[i]);
|
||||
trusted &= g_variant_is_trusted (children[i]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user