Skip to content

Commit

Permalink
Merge pull request #10554 from FRRouting/mergify/bp/stable/8.1/pr-10551
Browse files Browse the repository at this point in the history
bgpd: fix a couple of memleaks (backport #10551)
  • Loading branch information
donaldsharp committed Feb 10, 2022
2 parents ea4de81 + 8ef4af4 commit 2209692
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -3812,6 +3812,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (bgp_mac_entry_exists(p) || bgp_mac_exist(&attr->rmac)) {
peer->stat_pfx_nh_invalid++;
reason = "self mac;";
bgp_attr_flush(&new_attr);
goto filtered;
}

Expand All @@ -3828,13 +3829,15 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
&& (!CHECK_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED)))
SET_FLAG(dest->flags, BGP_NODE_FIB_INSTALL_PENDING);

attr_new = bgp_attr_intern(&new_attr);

/* If maximum prefix count is configured and current prefix
* count exeed it.
*/
if (bgp_maximum_prefix_overflow(peer, afi, safi, 0))
if (bgp_maximum_prefix_overflow(peer, afi, safi, 0)) {
bgp_attr_flush(&new_attr);
return -1;
}

attr_new = bgp_attr_intern(&new_attr);

/* If the update is implicit withdraw. */
if (pi) {
Expand Down Expand Up @@ -6771,6 +6774,7 @@ static bool aggr_suppress_map_test(struct bgp *bgp,
bgp->peer_self->rmap_type = 0;

bgp_attr_flush(&attr);
aspath_unintern(&attr.aspath);

return rmr == RMAP_PERMITMATCH;
}
Expand Down
6 changes: 3 additions & 3 deletions bgpd/rfapi/vnc_export_bgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,9 +972,6 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)

import_table = rfg->rfapi_import_table;

bgp_attr_default_set(&attr, BGP_ORIGIN_INCOMPLETE);
/* TBD set some configured med, see add_vnc_route() */

if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
Expand All @@ -983,6 +980,9 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
return;
}

bgp_attr_default_set(&attr, BGP_ORIGIN_INCOMPLETE);
/* TBD set some configured med, see add_vnc_route() */

/*
* Walk the NVE-Group's VNC Import table
*/
Expand Down

0 comments on commit 2209692

Please sign in to comment.