]> 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)
committerEnke Chen <enchen@paloaltonetworks.com>
Thu, 9 Jan 2025 22:48:35 +0000 (14:48 -0800)
Potential memory leak with as-set and matching-MED-only config.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
bgpd/bgp_route.c

index 88d7704ac95cccc47544538ca80b4b4e20405602..88e426fdb74c1c1954b8d4cf83874b11eac61035 100644 (file)
@@ -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) {
                /*