Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BGP memory backports #15568

Merged

bgpd: Ensure community data is freed in some cases.

a363a81
Select commit
Loading
Failed to load commit list.
Merged

BGP memory backports #15568

bgpd: Ensure community data is freed in some cases.
a363a81
Select commit
Loading
Failed to load commit list.
frrbot / frrbot completed Mar 18, 2024 in 6s

Style and/or linter errors found

Style and/or linter errors found

Details

Thanks for your contribution to FRR!

Click for style suggestions

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 56cdae0fa..227c738a2 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2879,7 +2879,7 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
 	struct peer *onlypeer;
 	afi_t afi;
 	safi_t safi;
-	struct attr attr = { 0 }, *pattr = &attr;
+	struct attr attr = {0}, *pattr = &attr;
 	struct bgp *bgp;
 	bool advertise;
 
@@ -2916,10 +2916,9 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
 			 */
 			if (advertise) {
 				if (!bgp_check_withdrawal(bgp, dest)) {
-					if (!bgp_adj_out_set_subgroup(dest,
-								      subgrp,
-								      pattr,
-								      selected))
+					if (!bgp_adj_out_set_subgroup(
+						    dest, subgrp, pattr,
+						    selected))
 						bgp_attr_flush(pattr);
 				} else {
 					bgp_adj_out_unset_subgroup(
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index baf86908b..ab030bfa9 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -813,7 +813,7 @@ void subgroup_announce_route(struct update_subgroup *subgrp)
 void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
 {
 	struct bgp *bgp;
-	struct attr attr = { 0 };
+	struct attr attr = {0};
 	struct attr *new_attr = &attr;
 	struct aspath *aspath;
 	struct prefix p;
@@ -957,13 +957,12 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
 				if (!CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
 					continue;
 
-				if (subgroup_announce_check(dest, pi, subgrp,
-							    bgp_dest_get_prefix(
-								    dest),
-							    &attr, NULL)) {
-					if (!bgp_adj_out_set_subgroup(dest,
-								      subgrp,
-								      &attr, pi))
+				if (subgroup_announce_check(
+					    dest, pi, subgrp,
+					    bgp_dest_get_prefix(dest), &attr,
+					    NULL)) {
+					if (!bgp_adj_out_set_subgroup(
+						    dest, subgrp, &attr, pi))
 						bgp_attr_flush(&attr);
 				} else
 					bgp_attr_flush(&attr);

To apply the style suggestions:

curl https://gist.githubusercontent.com/polychaeta/4e1e66610f13e3426ff20c224013eeb8/raw/ef1225b450a06d9087991e7424f5b997d2b85e6b/style.diff | git apply -

If you are a new contributor to FRR, please see our contributing guidelines.

After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.