From 9ff054f77796ba519c1ab5c69a76509243564ed4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 18 Nov 2020 12:10:22 -0500 Subject: [PATCH] bgpd: Do not leak vname if we find the match If we are attempting to store the bgp name for route leaking and we find a match do not leak the memory. Please note this is probably not really going to happen ever. Signed-off-by: Donald Sharp --- bgpd/bgp_mplsvpn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 202d56c06a..82aa811e98 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1707,6 +1707,8 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, if (!is_inst_match) listnode_add(to_bgp->vpn_policy[afi].import_vrf, vname); + else + XFREE(MTYPE_TMP, vname); /* Check if the source vrf already exports to any vrf, * first time export requires to setup auto derived RD/RT values. @@ -1729,6 +1731,9 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, if (!is_inst_match) listnode_add(from_bgp->vpn_policy[afi].export_vrf, vname); + else + XFREE(MTYPE_TMP, vname); + /* Update import RT for current VRF using export RT of the VRF we're * importing from. First though, make sure "import_vrf" has that * set. -- 2.39.5