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)

# Conflicts:
#	bgpd/bgp_vty.c
  • Loading branch information
pguibert6WIND authored and mergify[bot] committed Dec 20, 2024
1 parent f4d813f commit d2db218
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -8959,6 +8959,13 @@ DEFPY (af_rd_vpn_export,
bgp_get_default(), bgp);

if (yes) {
<<<<<<< HEAD
=======
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);
>>>>>>> 0dd96287d (bgpd: fix memory leak when reconfiguring a route distinguisher)
bgp->vpn_policy[afi].tovpn_rd = prd;
SET_FLAG(bgp->vpn_policy[afi].flags,
BGP_VPN_POLICY_TOVPN_RD_SET);
Expand Down

0 comments on commit d2db218

Please sign in to comment.