summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorEnke Chen <enchen@paloaltonetworks.com>2025-01-09 23:48:35 +0100
committerEnke Chen <enchen@paloaltonetworks.com>2025-01-09 23:48:35 +0100
commit36ce18d278456ec0084b92ece0100fb5effb23e3 (patch)
tree1996df1853b72c4f53dfbcd696bb7b10d09b76cb /bgpd
parentMerge pull request #17795 from gromit1811/bugfix_priv_syscaps_alloc (diff)
downloadfrr-36ce18d278456ec0084b92ece0100fb5effb23e3.tar.xz
frr-36ce18d278456ec0084b92ece0100fb5effb23e3.zip
bgpd: fix memory leak in bgp_aggregate_install()
Potential memory leak with as-set and matching-MED-only config. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 88d7704ac..88e426fdb 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -8000,8 +8000,15 @@ static void bgp_aggregate_install(
* If we have paths with different MEDs, then don't install
* (or uninstall) the aggregate route.
*/
- if (aggregate->match_med && aggregate->med_mismatched)
+ if (aggregate->match_med && aggregate->med_mismatched) {
+ aspath_free(aspath);
+ community_free(&community);
+ ecommunity_free(&ecommunity);
+ lcommunity_free(&lcommunity);
+ if (debug)
+ zlog_debug(" aggregate %pFX: med mismatch", p);
goto uninstall_aggregate_route;
+ }
if (aggregate->count > 0) {
/*