summaryrefslogtreecommitdiff
path: root/tests/gimarshallingtests.c
diff options
context:
space:
mode:
authorSimon Feltman <s.feltman@gmail.com>2016-12-23 15:19:44 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2018-07-27 20:46:47 -0400
commit29adf615baa95a0a4cd0cccd5e1b6364b59443ea (patch)
tree91b981e325e2fd0631948c23266e7a75b1799dcd /tests/gimarshallingtests.c
parent07144de1b8a5e47061324f5fc2166daad4c9c94f (diff)
downloadgobject-introspection-29adf615baa95a0a4cd0cccd5e1b6364b59443ea.tar.gz
gimarshallingtests: Don't leak properties in destruction
Clear strv, boxed_struct, variant, boxed_glist, and object properties during destruction. This fixes trivial memory leaks found in the PyGObject tests suite. https://bugzilla.gnome.org/show_bug.cgi?id=735013 Closes #113
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r--tests/gimarshallingtests.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 4005acae..4465bcb6 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -5371,15 +5371,12 @@ gi_marshalling_tests_properties_object_finalize (GObject *obj)
GIMarshallingTestsPropertiesObject *self;
self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (obj);
- if (self->some_strv != NULL) {
- g_strfreev (self->some_strv);
- self->some_strv = NULL;
- }
-
- if (self->some_gvalue) {
- g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
- self->some_gvalue = NULL;
- }
+ g_clear_pointer (&self->some_strv, g_strfreev);
+ g_clear_pointer (&self->some_boxed_struct, gi_marshalling_tests_boxed_struct_free);
+ g_clear_pointer (&self->some_variant, g_variant_unref);
+ g_clear_pointer (&self->some_boxed_glist, g_list_free);
+ g_clear_pointer (&self->some_gvalue, g_boxed_free);
+ g_clear_object (&self->some_object);
G_OBJECT_CLASS (gi_marshalling_tests_properties_object_parent_class)->finalize (obj);
}