zebra: handle depends_find() NULL nexthop

SA warned us lookup could be NULL dereferenced in some
paths. Handle the case where we are passed a NULL
nexthop before we try to copy it.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-10-28 21:37:05 -04:00
parent ff5d5005a2
commit 606fa9e58d

View File

@ -1000,6 +1000,9 @@ static struct nhg_hash_entry *depends_find(struct nexthop *nh, afi_t afi)
struct nexthop *lookup = NULL;
struct nhg_hash_entry *nhe = NULL;
if (!nh)
goto done;
copy_nexthops(&lookup, nh, NULL);
/* Clear it, in case its a group */
@ -1012,6 +1015,7 @@ static struct nhg_hash_entry *depends_find(struct nexthop *nh, afi_t afi)
nexthops_free(lookup);
done:
return nhe;
}