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>
This commit is contained in:
Rafael Zalamena 2021-12-13 17:21:56 -03:00
parent 08583527b2
commit 8bd0d3b1db

View file

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