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




commit 0b40c051a502d81e5572722d60f0c62526661983
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]