[gobject-introspection] gthash: free cmph objects



commit a50e377d6a2d88c39b6d2a3bcd1d1c10afa478b2
Author: Tobias Mueller <muelli cryptobitch de>
Date:   Fri Sep 9 12:53:11 2016 +0200

    gthash:  free cmph objects
    
    If not done, it would leak the memory as address sanitizer reports:
    
    ==1294==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x7fa7a94b7602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
        #1 0x44c7a7 in __config_new girepository/cmph/cmph_structs.c:11
        #2 0x44aaa7 in cmph_config_new girepository/cmph/cmph.c:291
        #3 0x446fb5 in _gi_typelib_hash_builder_prepare girepository/gthash.c:114
        #4 0x406cf7 in add_directory_index_section girepository/girmodule.c:270
        #5 0x409ee6 in _g_ir_module_build_typelib girepository/girmodule.c:546
        #6 0x404ada in main tools/compiler.c:217
        #7 0x7fa7a70d482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    
    ==4091==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x7fc20c854602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
        #1 0x44a3f3 in cmph_io_vector_new girepository/cmph/cmph.c:228
        #2 0x44a965 in cmph_io_vector_adapter girepository/cmph/cmph.c:276
        #3 0x446f9f in _gi_typelib_hash_builder_prepare girepository/gthash.c:113
        #4 0x406cf7 in add_directory_index_section girepository/girmodule.c:270
        #5 0x409ee6 in _g_ir_module_build_typelib girepository/girmodule.c:546
        #6 0x404ada in main tools/compiler.c:217
        #7 0x7fc20a47182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

 girepository/gthash.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/girepository/gthash.c b/girepository/gthash.c
index 831c87e..7440913 100644
--- a/girepository/gthash.c
+++ b/girepository/gthash.c
@@ -129,6 +129,8 @@ _gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder)
   builder->dirmap_offset = ALIGN_VALUE (offset, 4);
   builder->packed_size = builder->dirmap_offset + (num_elts * sizeof(guint16));
  out:
+  cmph_config_destroy (config);
+  cmph_io_vector_adapter_destroy (io);
   return builder->buildable;
 }
 


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