]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Do not leak vname if we find the match
authorDonald Sharp <sharpd@nvidia.com>
Wed, 18 Nov 2020 17:10:22 +0000 (12:10 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 18 Nov 2020 17:10:22 +0000 (12:10 -0500)
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 <sharpd@nvidia.com>
bgpd/bgp_mplsvpn.c

index 662c5da414954607a89df35b8bdb62138de4ac66..612c8ceee77ca1be84ea5a7bdb0ccc19eea9cf61 100644 (file)
@@ -1703,6 +1703,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.
@@ -1725,6 +1727,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.