From: Donatas Abraitis Date: Mon, 27 Feb 2023 20:15:07 +0000 (+0200) Subject: bgpd: Free aggregate route memory on shutdown X-Git-Tag: base_9.0~346^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=69a9680a785d4edf443f614149133c8ce9646fc8;p=matthieu%2Ffrr.git bgpd: Free aggregate route memory on shutdown Memory leak happens on shutdown or if BGP already deconfigured. Signed-off-by: Donatas Abraitis --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 0beef97a04..80f807a1a0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7638,9 +7638,11 @@ void bgp_aggregate_route(struct bgp *bgp, const struct prefix *p, afi_t afi, /* If the bgp instance is being deleted or self peer is deleted * then do not create aggregate route */ - if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS) - || (bgp->peer_self == NULL)) + if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS) || + (bgp->peer_self == NULL)) { + bgp_aggregate_free(aggregate); return; + } /* Initialize and test routes for MED difference. */ if (aggregate->match_med)