mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 09:30:30 +00:00
Merge pull request #11982 from samanvithab/bgp_mem_fix
bgpd: multiple memory leak issue fixes
This commit is contained in:
commit
344d81ceed
@ -1383,7 +1383,7 @@ bool ecommunity_del_val(struct ecommunity *ecom, struct ecommunity_val *eval)
|
|||||||
XFREE(MTYPE_ECOMMUNITY_VAL, ecom->val);
|
XFREE(MTYPE_ECOMMUNITY_VAL, ecom->val);
|
||||||
ecom->val = p;
|
ecom->val = p;
|
||||||
} else
|
} else
|
||||||
ecom->val = NULL;
|
XFREE(MTYPE_ECOMMUNITY_VAL, ecom->val);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1464,6 +1464,11 @@ int bgp_stop(struct peer *peer)
|
|||||||
|
|
||||||
/* There is no pending EOR message */
|
/* There is no pending EOR message */
|
||||||
if (gr_info->eor_required == 0) {
|
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);
|
THREAD_OFF(gr_info->t_select_deferral);
|
||||||
gr_info->eor_received = 0;
|
gr_info->eor_received = 0;
|
||||||
}
|
}
|
||||||
|
@ -1988,9 +1988,15 @@ void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw,
|
|||||||
bgp->vpn_policy[afi].tovpn_rd = bgp->vrf_prd_auto;
|
bgp->vpn_policy[afi].tovpn_rd = bgp->vrf_prd_auto;
|
||||||
prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd, buf,
|
prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd, buf,
|
||||||
sizeof(buf));
|
sizeof(buf));
|
||||||
bgp->vpn_policy[afi].rtlist[edir] =
|
|
||||||
ecommunity_str2com(buf,
|
/* free up pre-existing memory if any and allocate
|
||||||
ECOMMUNITY_ROUTE_TARGET, 0);
|
* the ecommunity attribute with new RD/RT
|
||||||
|
*/
|
||||||
|
if (bgp->vpn_policy[afi].rtlist[edir])
|
||||||
|
ecommunity_free(
|
||||||
|
&bgp->vpn_policy[afi].rtlist[edir]);
|
||||||
|
bgp->vpn_policy[afi].rtlist[edir] = ecommunity_str2com(
|
||||||
|
buf, ECOMMUNITY_ROUTE_TARGET, 0);
|
||||||
|
|
||||||
/* Update import_vrf rt_list */
|
/* Update import_vrf rt_list */
|
||||||
ecom = bgp->vpn_policy[afi].rtlist[edir];
|
ecom = bgp->vpn_policy[afi].rtlist[edir];
|
||||||
|
@ -2054,6 +2054,11 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
|
|||||||
gr_info->eor_required,
|
gr_info->eor_required,
|
||||||
"EOR RCV",
|
"EOR RCV",
|
||||||
gr_info->eor_received);
|
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);
|
THREAD_OFF(gr_info->t_select_deferral);
|
||||||
gr_info->eor_required = 0;
|
gr_info->eor_required = 0;
|
||||||
gr_info->eor_received = 0;
|
gr_info->eor_received = 0;
|
||||||
|
16
bgpd/bgpd.c
16
bgpd/bgpd.c
@ -3631,7 +3631,12 @@ int bgp_delete(struct bgp *bgp)
|
|||||||
gr_info = &bgp->gr_info[afi][safi];
|
gr_info = &bgp->gr_info[afi][safi];
|
||||||
if (!gr_info)
|
if (!gr_info)
|
||||||
continue;
|
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);
|
THREAD_OFF(gr_info->t_select_deferral);
|
||||||
|
|
||||||
t = gr_info->t_route_select;
|
t = gr_info->t_route_select;
|
||||||
@ -3714,6 +3719,17 @@ int bgp_delete(struct bgp *bgp)
|
|||||||
bgp->vpn_policy[afi].import_redirect_rtlist = NULL;
|
bgp->vpn_policy[afi].import_redirect_rtlist = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free any memory allocated to holding routemap references */
|
||||||
|
for (afi = 0; afi < AFI_MAX; ++afi) {
|
||||||
|
for (enum vpn_policy_direction dir = 0;
|
||||||
|
dir < BGP_VPN_POLICY_DIR_MAX; ++dir) {
|
||||||
|
if (bgp->vpn_policy[afi].rmap_name[dir])
|
||||||
|
XFREE(MTYPE_ROUTE_MAP_NAME,
|
||||||
|
bgp->vpn_policy[afi].rmap_name[dir]);
|
||||||
|
bgp->vpn_policy[afi].rmap[dir] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Deregister from Zebra, if needed */
|
/* Deregister from Zebra, if needed */
|
||||||
if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
|
if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
|
||||||
if (BGP_DEBUG(zebra, ZEBRA))
|
if (BGP_DEBUG(zebra, ZEBRA))
|
||||||
|
Loading…
Reference in New Issue
Block a user