]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Cleanup memory leaks associated with t_deferral_timer
authorSamanvitha B Bhargav <bsamanvitha@vmware.com>
Wed, 21 Sep 2022 10:18:06 +0000 (03:18 -0700)
committerSamanvitha B Bhargav <bsamanvitha@vmware.com>
Fri, 23 Sep 2022 07:14:12 +0000 (00:14 -0700)
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: Samanvitha B Bhargav <bsmanvitha@vmware.com>
bgpd/bgp_fsm.c
bgpd/bgp_packet.c
bgpd/bgpd.c

index a8accc25f505f3c33f46141bf38b992b6acefd09..ddda10077456bfc11094932a1b27519b92a053d2 100644 (file)
@@ -1464,6 +1464,11 @@ int bgp_stop(struct peer *peer)
 
                                /* There is no pending EOR message */
                                if (gr_info->eor_required == 0) {
+                                       if (gr_info->t_select_deferral) {
+                                               void *info = THREAD_ARG(
+                                                       gr_info->t_select_deferral);
+                                               XFREE(MTYPE_TMP, info);
+                                       }
                                        THREAD_OFF(gr_info->t_select_deferral);
                                        gr_info->eor_received = 0;
                                }
index cc188083733650345756b836166879bf5044506e..8ae31bf2e695ac56044428435322f9210ed9cf38 100644 (file)
@@ -2054,6 +2054,11 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
                                                        gr_info->eor_required,
                                                        "EOR RCV",
                                                        gr_info->eor_received);
+                                       if (gr_info->t_select_deferral) {
+                                               void *info = THREAD_ARG(
+                                                       gr_info->t_select_deferral);
+                                               XFREE(MTYPE_TMP, info);
+                                       }
                                        THREAD_OFF(gr_info->t_select_deferral);
                                        gr_info->eor_required = 0;
                                        gr_info->eor_received = 0;
index 919d3f034dc206d03e3643d388a2ba921627e571..94cf12272a46e172ada4d558c903c052678e170b 100644 (file)
@@ -3630,7 +3630,12 @@ int bgp_delete(struct bgp *bgp)
                gr_info = &bgp->gr_info[afi][safi];
                if (!gr_info)
                        continue;
+               t = gr_info->t_select_deferral;
+               if (t) {
+                       void *info = THREAD_ARG(t);
 
+                       XFREE(MTYPE_TMP, info);
+               }
                THREAD_OFF(gr_info->t_select_deferral);
 
                t = gr_info->t_route_select;