summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_snmp.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_snmp.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_snmp.c')
-rw-r--r--bgpd/bgp_snmp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 61a6467ab..4baa730c8 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -689,12 +689,12 @@ static struct bgp_path_info *bgp4PathAttrLookup(struct variable *v, oid name[],
dest = bgp_node_lookup(bgp->rib[AFI_IP][SAFI_UNICAST],
(struct prefix *)addr);
if (dest) {
- bgp_dest_unlock_node(dest);
-
for (path = bgp_dest_get_bgp_path_info(dest); path;
path = path->next)
if (sockunion_same(&path->peer->su, &su))
return path;
+
+ bgp_dest_unlock_node(dest);
}
} else {
offset = name + v->namelen;