summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_updgrp_adv.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-06-22 22:14:47 +0200
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-06-22 22:14:47 +0200
commite71ad4b64eebd88c5ee010d249844fc28d29fa66 (patch)
treefc04d189faff2cbbbaa884eadd670e920d5f2f6f /bgpd/bgp_updgrp_adv.c
parentMerge pull request #8892 from idryzhov/fabric-no-instance (diff)
downloadfrr-e71ad4b64eebd88c5ee010d249844fc28d29fa66.tar.xz
frr-e71ad4b64eebd88c5ee010d249844fc28d29fa66.zip
bgpd: Make sure we don't miss to unlock for bgp_dest before returning
bgp_node_lookup() increases `lock` which is not decreased on return. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'bgpd/bgp_updgrp_adv.c')
-rw-r--r--bgpd/bgp_updgrp_adv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index bb0c95e32..af37130b7 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -883,7 +883,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
/* If default route is present in the local RIB, advertise the
* route
*/
- if (dest != NULL) {
+ if (dest) {
for (pi = bgp_dest_get_bgp_path_info(dest); pi;
pi = pi->next) {
if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
@@ -895,6 +895,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
dest, subgrp, &attr,
pi);
}
+ bgp_dest_unlock_node(dest);
}
} else {
if (!CHECK_FLAG(subgrp->sflags,
@@ -907,7 +908,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
* clear adj_out for the 0.0.0.0/0 prefix in the BGP
* table.
*/
- if (dest != NULL) {
+ if (dest) {
/* Remove the adjacency for the previously
* advertised default route
*/
@@ -923,6 +924,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
/* Free allocated information. */
adj_free(adj);
}
+ bgp_dest_unlock_node(dest);
}
/* Advertise the default route */