mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-25 16:46:52 +02:00
gvariant: Fix memory leak on a TYPE_CHECK failure
This commit is contained in:
parent
88604931bb
commit
d25f5c0dfb
@ -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