]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix memory leak in bgp_aggregate_install()
authorEnke Chen <enchen@paloaltonetworks.com>
Thu, 9 Jan 2025 22:48:35 +0000 (14:48 -0800)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 10 Jan 2025 07:52:24 +0000 (09:52 +0200)
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>
bgpd/bgp_route.c

index 93d27aa167c69288c6c5541f8675f8ef8326de4d..a87cd21f22e3557b71fd6774268030bf7f083391 100644 (file)
@@ -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) {
                /*