summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnke Chen <enchen@paloaltonetworks.com>2025-01-09 14:48:35 -0800
committerDonatas Abraitis <donatas@opensourcerouting.org>2025-01-10 09:52:24 +0200
commit94ca6ddfae959a08e84a7a5a070f44ddba70f156 (patch)
treeb89168f704d484b0a00050a102bafe843ba9b3cd
parent22d95f4ba8444171944eab29e99dfa6087813d6f (diff)
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> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
-rw-r--r--bgpd/bgp_route.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 93d27aa167..a87cd21f22 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -7753,8 +7753,13 @@ 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);
goto uninstall_aggregate_route;
+ }
if (aggregate->count > 0) {
/*