]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Free aggregate route memory on shutdown
authorDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 27 Feb 2023 20:15:07 +0000 (22:15 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 27 Feb 2023 20:15:07 +0000 (22:15 +0200)
Memory leak happens on shutdown or if BGP already deconfigured.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_route.c

index 0beef97a040641e1fdaa620c4385934fe5533665..80f807a1a0c57ade2af8989ad32fb52b5ef2bd90 100644 (file)
@@ -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)