[PATCH 1/3] qht: Zero-initialize qht_map

Peter Xu posted 3 patches 1 month, 2 weeks ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
[PATCH 1/3] qht: Zero-initialize qht_map
Posted by Peter Xu 1 month, 2 weeks ago
QEMU almost always do this across the tree except QHT.  This prepares for
rcu to track double free.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 util/qht.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/qht.c b/util/qht.c
index 208c2f4b32..872d9f9cec 100644
--- a/util/qht.c
+++ b/util/qht.c
@@ -441,7 +441,7 @@ static struct qht_map *qht_map_create(size_t n_buckets)
     struct qht_map *map;
     size_t i;
 
-    map = g_malloc(sizeof(*map));
+    map = g_malloc0(sizeof(*map));
     map->n_buckets = n_buckets;
 
     map->n_added_buckets = 0;
-- 
2.50.1