[gobject-introspection] tests: Fix memory leak in GIMarshallingTestsPropertiesObject



commit 8c2129f22f6c3eb9eb89f36a59e151794edbf4bb
Author: Martin Pitt <martinpitt gnome org>
Date:   Mon Mar 4 13:00:51 2013 +0100

    tests: Fix memory leak in GIMarshallingTestsPropertiesObject
    
    Free the some_strv property on finalization.
    
    Detected by PyGObject's test_gi.TestPropertiesObject.test_strv test case.

 tests/gimarshallingtests.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 4931778..2851c4d 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4948,6 +4948,14 @@ static void gi_marshalling_tests_properties_object_init (GIMarshallingTestsPrope
 static void
 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;
+  }
+
   G_OBJECT_CLASS (gi_marshalling_tests_properties_object_parent_class)->finalize (obj);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]