summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2022-02-10 14:47:13 +0200
committerGitHub <noreply@github.com>2022-02-10 14:47:13 +0200
commit6cb7c5d9b1d239d83c7cbab4984903691fe5abee (patch)
tree4ae985dfb24fe43741de74b534488a4028b497ee
parentd992107a44b9b69317238bfb91fdbf2f9408241e (diff)
parent955cc29fb604e456184efaf73b6719ce66c614ee (diff)
Merge pull request #10553 from FRRouting/mergify/bp/dev/8.2/pr-10551
bgpd: fix a couple of memleaks (backport #10551)
-rw-r--r--bgpd/bgp_route.c10
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c6
2 files changed, 10 insertions, 6 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 6e47eeda56..4864089f8a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3927,6 +3927,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;
}
@@ -3943,13 +3944,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) {
@@ -6933,6 +6936,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;
}
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index 68dc5a4f60..534ddcc64b 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -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 {
@@ -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
*/