[glib: 17/19] gvdb-builder: Initialise some memory to zero in the bloom filter



commit ea64c739239faea463f3cb9154a12cc4532ba525
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Mar 18 09:15:59 2020 +0000

    gvdb-builder: Initialise some memory to zero in the bloom filter
    
    Until a bloom filter is implemented, we need to ensure that all the
    memory returned by `file_builder_allocate()` is initialised, since it’s
    not initialised at allocation time.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Fixes: #2

 gvdb-builder.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gvdb-builder.c b/gvdb-builder.c
index 39426670c..b8ecbe3d7 100644
--- a/gvdb-builder.c
+++ b/gvdb-builder.c
@@ -339,6 +339,8 @@ file_builder_allocate_for_hash (FileBuilder            *fb,
 #undef chunk
 
   memset (*bloom_filter, 0, n_bloom_words * sizeof (guint32_le));
+  memset (*hash_buckets, 0, n_buckets * sizeof (guint32_le));
+  memset (*hash_items, 0, n_items * sizeof (struct gvdb_hash_item));
 
   /* NOTE - the code to actually fill in the bloom filter here is missing.
    * Patches welcome!


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