From 1c8c67c8e62dafe35fbe06f36e5fc31c9e97a4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 6 Apr 2023 18:04:09 +0200 Subject: gimarshallingtests: Do not leak GIMarshallingTests boxed structure These are part of the array that we return, so there's no need to allocate a new structure. And this was leading to false positive leaks in bindings. --- tests/gimarshallingtests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index b1c765c2..dbe5185a 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -2011,11 +2011,13 @@ gi_marshalling_tests_garray_boxed_struct_full_return (void) gint i; array = g_array_new (TRUE, TRUE, sizeof (GIMarshallingTestsBoxedStruct)); + g_array_set_size (array, 3); for (i = 0; i < 3; i++) { - GIMarshallingTestsBoxedStruct *new_struct = gi_marshalling_tests_boxed_struct_new (); + GIMarshallingTestsBoxedStruct *new_struct; + new_struct = &g_array_index (array, GIMarshallingTestsBoxedStruct, i); + memset (new_struct, 0, sizeof (GIMarshallingTestsSimpleStruct)); new_struct->long_ = long_values[i]; - g_array_append_val (array, *new_struct); } return array; -- cgit v1.2.1