]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: bgp_connected_add memory was being leaked in some cases 12558/head
authorDonald Sharp <sharpd@nvidia.com>
Thu, 22 Dec 2022 00:26:58 +0000 (19:26 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 22 Dec 2022 13:15:52 +0000 (08:15 -0500)
On shutdown, bgp calls an unlock for the bnc connected table,
via the bgp_connected_cleanup function.  This function is
only ever called on shutdown, so we know that bgp is going
away.  The refcount for the connected data can be more than
1.  Let's not worry about the refcount on shutdown and
just delete the nodes instead of leaving them around.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_nexthop.c

index 25a4a1b521ae41b098e5c175133b8482356e6527..6bbdbdc1a95bc20b9b2c1e86cb92aaa64f86bf9e 100644 (file)
@@ -500,11 +500,8 @@ static void bgp_connected_cleanup(struct route_table *table,
        if (!bc)
                return;
 
-       bc->refcnt--;
-       if (bc->refcnt == 0) {
-               XFREE(MTYPE_BGP_CONN, bc);
-               bgp_dest_set_bgp_connected_ref_info(bn, NULL);
-       }
+       XFREE(MTYPE_BGP_CONN, bc);
+       bgp_dest_set_bgp_connected_ref_info(bn, NULL);
 }
 
 bool bgp_nexthop_self(struct bgp *bgp, afi_t afi, uint8_t type,