summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2023-04-06 18:04:09 +0200
committerPhilip Chimento <philip.chimento@gmail.com>2023-04-09 19:51:31 +0000
commit1c8c67c8e62dafe35fbe06f36e5fc31c9e97a4a5 (patch)
tree28c423261f0d0cfbd8fc74a9368327fc1c3940ef
parent5ee29cbfe92047b49c64816ab0f79470c7eac51c (diff)
downloadgobject-introspection-1c8c67c8e62dafe35fbe06f36e5fc31c9e97a4a5.tar.gz
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.
-rw-r--r--tests/gimarshallingtests.c6
1 files 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;