[gobject-introspection] tests: Avoid handing out uninitialized memory



commit c66bd85d20de927fa220f770c15b3c312298f019
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Sat Jan 19 16:03:08 2013 +0100

    tests: Avoid handing out uninitialized memory
    
    gi_marshalling_tests_boxed_struct_out and
    gi_marshalling_tests_boxed_struct_inout allocated memory without completely
    initializing it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692084

 tests/gimarshallingtests.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 21d31e0..7855dd7 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3738,7 +3738,7 @@ gi_marshalling_tests_boxed_struct_out (GIMarshallingTestsBoxedStruct **struct_)
     static GIMarshallingTestsBoxedStruct *new_struct = NULL;
 
     if (new_struct == NULL) {
-        new_struct = g_new(GIMarshallingTestsBoxedStruct, 1);
+        new_struct = g_new0(GIMarshallingTestsBoxedStruct, 1);
 
         new_struct->long_ = 42;
     }
@@ -3755,7 +3755,7 @@ gi_marshalling_tests_boxed_struct_inout (GIMarshallingTestsBoxedStruct **struct_
 {
     g_assert_cmpint((*struct_)->long_, ==, 42);
 
-    (*struct_) = g_slice_new (GIMarshallingTestsBoxedStruct);
+    (*struct_) = g_slice_new0 (GIMarshallingTestsBoxedStruct);
     (*struct_)->long_ = 0;
 }
 



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