[PATCH 2/2] proto/bgp: zero the newly allocated bucket memory

Andreas Rammhold andreas at rammhold.de
Tue Nov 24 09:08:31 CET 2020


I did observe crashes when running BIRD as a debug build when memory
returned from the allocator was supposedly not being zeroed. This became
mandatory as of baac7009063d the next and prev pointers of nodes in a
list are checked against NULL in debug builds.
---
 proto/bgp/attrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 828bc118..b4001f59 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -1476,7 +1476,7 @@ bgp_get_bucket(struct bgp_channel *c, ea_list *new)
   }
 
   /* Create the bucket */
-  b = mb_alloc(c->pool, size);
+  b = mb_allocz(c->pool, size);
   init_list(&b->prefixes);
   b->hash = hash;
 
-- 
2.29.2



More information about the Bird-users mailing list