]> 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)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 14 Jan 2025 15:13:36 +0000 (15:13 +0000)
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>
(cherry picked from commit 94ca6ddfae959a08e84a7a5a070f44ddba70f156)

bgpd/bgp_route.c

index f42b2d307981791ab06ff3f461a5827026bc3692..c61462f2becd74a3a86004c0eb663ccde102a9e2 100644 (file)
@@ -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) {
                /*