]> 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:12 +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 788278192a4cb73f6c5bda8a5613eceb4892936d..14cbe65ebbd8e3c50a5c3e26c3be217aee6834ea 100644 (file)
@@ -1053,7 +1053,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;
 }