]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix aggregate route AS Path attribute
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 13 Dec 2021 20:21:56 +0000 (17:21 -0300)
committermergify-bot <noreply@mergify.com>
Tue, 21 Dec 2021 16:15:31 +0000 (16:15 +0000)
Always free the locally allocated attribute not the one we are using for
return. This fixes a memory leak and a crash when AS Path is set with
route-map.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit 8bd0d3b1db2eeaeaf9c6f5eedc9b7779233ad8df)

bgpd/bgp_attr.c

index 7de7a6628f8b1ffda3c6f898db34c2c4e557648b..c765be432cfc8b717140c7e81ab59e7e240992a7 100644 (file)
@@ -1073,7 +1073,9 @@ struct attr *bgp_attr_aggregate_intern(
                new = bgp_attr_intern(&attr);
        }
 
-       aspath_unintern(&new->aspath);
+       /* Always release the 'intern()'ed AS Path. */
+       aspath_unintern(&attr.aspath);
+
        return new;
 }