summaryrefslogtreecommitdiff
path: root/bgpd/bgp_vty.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2024-12-18 16:53:48 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-12-20 14:16:07 +0000
commitfee57833d7870912e5c3b32cb787ec7ca9301ed8 (patch)
tree06309b5f0ee198635f07d1448cdaea216e954a22 /bgpd/bgp_vty.c
parent80f5df3f09a19c4a8f52b43c55fe9885b9ce42a1 (diff)
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 <philippe.guibert@6wind.com> (cherry picked from commit 0dd96287dda22b79ef6d7424f4e1a8dc92959f92)
Diffstat (limited to 'bgpd/bgp_vty.c')
-rw-r--r--bgpd/bgp_vty.c2
1 files changed, 2 insertions, 0 deletions
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;