]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Fix NULL check in zebra_nhg_rib_find()
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 3 Sep 2019 19:10:21 +0000 (15:10 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:43 +0000 (11:13 -0400)
Check both the nhg and nexthop are not NULL before passing
them to be hashed. Clang SA caught this.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c

index 8cc18771065b6aafe43ff930b60e6506d0ee0113..8fb4f3357b0ae11d56966f55adacfbcaa6c862a8 100644 (file)
@@ -1033,15 +1033,13 @@ zebra_nhg_rib_find(uint32_t id, struct nexthop_group *nhg, afi_t rt_afi)
 {
        struct nhg_hash_entry *nhe = NULL;
 
-       vrf_id_t nhg_vrf_id = nhg->nexthop->vrf_id;
-
-       if (!nhg) {
+       if (!(nhg && nhg->nexthop)) {
                flog_err(EC_ZEBRA_TABLE_LOOKUP_FAILED,
                         "No nexthop passed to %s", __func__);
                return NULL;
        }
 
-       zebra_nhg_find(&nhe, id, nhg, NULL, nhg_vrf_id, rt_afi, 0);
+       zebra_nhg_find(&nhe, id, nhg, NULL, nhg->nexthop->vrf_id, rt_afi, 0);
 
        return nhe;
 }