From: Philippe Guibert Date: Wed, 18 Dec 2024 15:53:48 +0000 (+0100) Subject: bgpd: fix memory leak when reconfiguring a route distinguisher X-Git-Tag: docker/10.0.3~3^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=fee57833d7870912e5c3b32cb787ec7ca9301ed8;p=matthieu%2Ffrr.git bgpd: fix memory leak when reconfiguring a route distinguisher A memory leak happens when reconfiguring an already configured route distinguisher on an L3VPN BGP instance. Fix this by freeing the previous route distinguisher. Signed-off-by: Philippe Guibert (cherry picked from commit 0dd96287dda22b79ef6d7424f4e1a8dc92959f92) --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index fdf84395e2..97ca5622b9 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -9482,6 +9482,8 @@ DEFPY (af_rd_vpn_export, bgp_get_default(), bgp); if (yes) { + if (bgp->vpn_policy[afi].tovpn_rd_pretty) + XFREE(MTYPE_BGP_NAME, bgp->vpn_policy[afi].tovpn_rd_pretty); bgp->vpn_policy[afi].tovpn_rd_pretty = XSTRDUP(MTYPE_BGP_NAME, rd_str); bgp->vpn_policy[afi].tovpn_rd = prd;