0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

BGP: Zero the newly allocated bucket structure

This fixes an issue with dirty node passed to add_tail().

Thanks to Andreas Rammhold for the initial patch.
This commit is contained in:
Ondrej Zajicek (work) 2020-11-25 15:44:00 +01:00
parent 62d57b9bdf
commit 2465867712

View File

@ -1477,6 +1477,7 @@ bgp_get_bucket(struct bgp_channel *c, ea_list *new)
/* Create the bucket */
b = mb_alloc(c->pool, size);
*b = (struct bgp_bucket) { };
init_list(&b->prefixes);
b->hash = hash;
@ -1601,9 +1602,7 @@ bgp_get_prefix(struct bgp_channel *c, net_addr *net, u32 path_id)
else
px = mb_alloc(c->pool, sizeof(struct bgp_prefix) + net->length);
px->buck_node.next = NULL;
px->buck_node.prev = NULL;
px->next = NULL;
*px = (struct bgp_prefix) { };
px->hash = hash;
px->path_id = path_id;
net_copy(px->net, net);