From: Enke Chen Date: Thu, 9 Jan 2025 22:48:35 +0000 (-0800) Subject: bgpd: fix memory leak in bgp_aggregate_install() X-Git-Tag: docker/10.1.3~34^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2ba4d715953affdc2cdd1685774d3ad32a8f169a;p=matthieu%2Ffrr.git bgpd: fix memory leak in bgp_aggregate_install() Potential memory leak with as-set and matching-MED-only config. Signed-off-by: Enke Chen Signed-off-by: Donatas Abraitis (cherry picked from commit 94ca6ddfae959a08e84a7a5a070f44ddba70f156) --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f42b2d3079..c61462f2be 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7672,8 +7672,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) { /*