bgpd: Prevent use after free from coverity's perspective

Prevent a use after free from coverity's perspective.  A
bgp node may have been freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2023-09-19 15:48:57 -04:00
parent e7f0bbb198
commit 4eaf14e1e3

View File

@ -1179,12 +1179,13 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,
/* Process change. */
bgp_aggregate_increment(to_bgp, p, bpi, afi, safi);
bgp_process(to_bgp, bn, afi, safi);
bgp_dest_unlock_node(bn);
if (debug)
zlog_debug("%s: ->%s: %pBD Found route, changed attr",
__func__, to_bgp->name_pretty, bn);
bgp_dest_unlock_node(bn);
return bpi;
}