Skip to content

Commit

Permalink
bgpd: fix memory leak when reconfiguring a route distinguisher
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit 0dd9628)
  • Loading branch information
pguibert6WIND authored and mergify[bot] committed Dec 20, 2024
1 parent 1437880 commit 87c3281
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -9816,6 +9816,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;
Expand Down

0 comments on commit 87c3281

Please sign in to comment.