]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Cleanup memory leaks associated with t_router_timer
authorDonald Sharp <sharpd@nvidia.com>
Thu, 5 Nov 2020 02:02:57 +0000 (21:02 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 5 Nov 2020 02:02:57 +0000 (21:02 -0500)
We are allocating temporary memory for information about
what to process in this thread, which is not being cleaned
up on thread cancelling.

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

index 0a741d1c4a4313e817147b8ec6f3475dd9846210..8a237e329e2acfcd6c970000764a5567e8a9e87c 100644 (file)
@@ -2919,8 +2919,13 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
        int cnt = 0;
        struct afi_safi_info *thread_info;
 
-       if (bgp->gr_info[afi][safi].t_route_select)
+       if (bgp->gr_info[afi][safi].t_route_select) {
+               struct thread *t = bgp->gr_info[afi][safi].t_route_select;
+
+               thread_info = THREAD_ARG(t);
+               XFREE(MTYPE_TMP, thread_info);
                BGP_TIMER_OFF(bgp->gr_info[afi][safi].t_route_select);
+       }
 
        if (BGP_DEBUG(update, UPDATE_OUT)) {
                zlog_debug("%s: processing route for %s : cnt %d", __func__,
index f868128e603cd808d61e35d3095638d1cb5dc4aa..0095a1cab062119a4daae9ed382505cb291c244a 100644 (file)
@@ -3394,11 +3394,20 @@ int bgp_delete(struct bgp *bgp)
 
        /* Delete the graceful restart info */
        FOREACH_AFI_SAFI (afi, safi) {
+               struct thread *t;
+
                gr_info = &bgp->gr_info[afi][safi];
                if (!gr_info)
                        continue;
 
                BGP_TIMER_OFF(gr_info->t_select_deferral);
+
+               t = gr_info->t_route_select;
+               if (t) {
+                       void *info = THREAD_ARG(t);
+
+                       XFREE(MTYPE_TMP, info);
+               }
                BGP_TIMER_OFF(gr_info->t_route_select);
        }