summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_table.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_table.c')
-rw-r--r--bgpd/bgp_table.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index c2120252..15630a24 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -36,8 +36,7 @@ bgp_table_init (afi_t afi, safi_t safi)
{
struct bgp_table *rt;
- rt = XMALLOC (MTYPE_BGP_TABLE, sizeof (struct bgp_table));
- memset (rt, 0, sizeof (struct bgp_table));
+ rt = XCALLOC (MTYPE_BGP_TABLE, sizeof (struct bgp_table));
rt->type = BGP_TABLE_MAIN;
rt->afi = afi;
@@ -56,11 +55,7 @@ bgp_table_finish (struct bgp_table **rt)
static struct bgp_node *
bgp_node_create ()
{
- struct bgp_node *rn;
-
- rn = (struct bgp_node *) XMALLOC (MTYPE_BGP_NODE, sizeof (struct bgp_node));
- memset (rn, 0, sizeof (struct bgp_node));
- return rn;
+ return XCALLOC (MTYPE_BGP_NODE, sizeof (struct bgp_node));
}
/* Allocate new route node with prefix set. */
@@ -369,6 +364,7 @@ bgp_node_delete (struct bgp_node *node)
assert (node->lock == 0);
assert (node->info == NULL);
+ assert (node->table->count > 0);
if (node->l_left && node->l_right)
return;