Commit b388c3e8 authored by Martin Pitt's avatar Martin Pitt
Browse files

Fix leaking of boxed array elements

Commit 631d8ef8 copies struct array elements, but this needlessly duplicates
and leaks the array element for boxed types. So only do it for plain structs.

This fixes the memory leak with test_gi.TestGValue.test_gvalue_flat_array_out.

https://bugzilla.gnome.org/show_bug.cgi?id=693402
parent 1dc2bc9f
......@@ -434,7 +434,8 @@ _pygi_marshal_to_py_array (PyGIInvokeState *state,
item_arg.v_pointer = g_variant_ref_sink (g_array_index (array_, gpointer, i));
else
item_arg.v_pointer = g_array_index (array_, gpointer, i);
} else if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && !item_arg_cache->is_pointer) {
} else if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && !item_arg_cache->is_pointer &&
!g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) {
/* array elements are structs */
gpointer *_struct = g_malloc (item_size);
memcpy (_struct, array_->data + i * item_size,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment