Merge pull request #14002 from opensourcerouting/fix/backport_memory_leaks_to_8.5

bgpd: Memory leaks in communities (backport)
This commit is contained in:
Donald Sharp 2023-07-13 09:19:17 -04:00 committed by GitHub
commit fee0744e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -2917,10 +2917,14 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
* in FIB, then it is advertised
*/
if (advertise) {
if (!bgp_check_withdrawal(bgp, dest))
bgp_adj_out_set_subgroup(
dest, subgrp, &attr, selected);
else
if (!bgp_check_withdrawal(bgp, dest)) {
struct attr *adv_attr =
bgp_attr_intern(&attr);
bgp_adj_out_set_subgroup(dest, subgrp,
adv_attr,
selected);
} else
bgp_adj_out_unset_subgroup(
dest, subgrp, 1, addpath_tx_id);
}

View File

@ -715,11 +715,14 @@ void subgroup_announce_table(struct update_subgroup *subgrp,
&attr, NULL)) {
/* Check if route can be advertised */
if (advertise) {
if (!bgp_check_withdrawal(bgp, dest))
if (!bgp_check_withdrawal(bgp, dest)) {
struct attr *adv_attr =
bgp_attr_intern(&attr);
bgp_adj_out_set_subgroup(
dest, subgrp, &attr,
dest, subgrp, adv_attr,
ri);
else
} else
bgp_adj_out_unset_subgroup(
dest, subgrp, 1,
bgp_addpath_id_for_peer(