summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2021-12-13 17:21:56 -0300
committerRafael Zalamena <rzalamena@opensourcerouting.org>2021-12-21 10:48:18 -0300
commit8bd0d3b1db2eeaeaf9c6f5eedc9b7779233ad8df (patch)
tree3cadf60944fc866a74d2d559445bc12a86842d8f
parent08583527b2e8c708e60fce2aee39474b9f543396 (diff)
bgpd: fix aggregate route AS Path attribute
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>
-rw-r--r--bgpd/bgp_attr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 7de7a6628f..c765be432c 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -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;
}