]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: null check (Coverity 1472237) 2781/head
authorF. Aragon <paco@voltanet.io>
Fri, 3 Aug 2018 13:23:26 +0000 (15:23 +0200)
committerF. Aragon <paco@voltanet.io>
Fri, 3 Aug 2018 14:26:14 +0000 (16:26 +0200)
Signed-off-by: F. Aragon <paco@voltanet.io>
bgpd/bgp_table.c

index 94e2d83cfe1ff287f99fbb6430c0a3a1e72f66c3..234553b6ead27dd8262d00e666f3115b86a62c9e 100644 (file)
@@ -144,9 +144,6 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
        struct bgp_node *node = bgp_node_from_rnode(table->route_table->top);
        struct bgp_node *matched = NULL;
 
-       if (node == NULL)
-               return;
-
        while (node && node->p.prefixlen <= p->prefixlen
               && prefix_match(&node->p, p)) {
                if (node->info && node->p.prefixlen == p->prefixlen) {
@@ -157,6 +154,9 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
                        &p->u.prefix, node->p.prefixlen)]);
        }
 
+       if (node == NULL)
+               return;
+
        if ((matched == NULL && node->p.prefixlen > maxlen) || !node->parent)
                return;
        else if (matched == NULL)