[glib/halfline/debug-metrics: 7/19] gbsearcharray: Zero out the entire allocated block




commit 3f1db57ccc903be849214f2cc2ab2444f98a99ea
Author: Ray Strode <rstrode redhat com>
Date:   Mon May 10 10:01:46 2021 -0400

    gbsearcharray: Zero out the entire allocated block
    
    GBSearchArray currently only zeros out the front of its allocated
    block.
    
    This commit changes it to zero out the whole block.

 glib/gbsearcharray.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/glib/gbsearcharray.h b/glib/gbsearcharray.h
index 832522e27..825618d0d 100644
--- a/glib/gbsearcharray.h
+++ b/glib/gbsearcharray.h
@@ -133,8 +133,7 @@ g_bsearch_array_create (const GBSearchConfig *bconfig)
   size = sizeof (GBSearchArray) + bconfig->sizeof_node;
   if (bconfig->flags & G_BSEARCH_ARRAY_ALIGN_POWER2)
     size = G_BSEARCH_UPPER_POWER2 (size);
-  barray = (GBSearchArray *) g_malloc (size);
-  memset (barray, 0, sizeof (GBSearchArray));
+  barray = (GBSearchArray *) g_malloc0(size);
 
   return barray;
 }


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