Memory leak happens on shutdown or if BGP already deconfigured.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
/* 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)