summaryrefslogtreecommitdiffstats
path: root/bfdd/bfd_packet.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2022-07-06 12:49:56 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2022-07-06 12:49:56 +0200
commit500fe387a0e4ff474e3f85a317ac73f733dccf01 (patch)
treebf217ec0c1af779325dc4a1adebcf9e537d8d17e /bfdd/bfd_packet.c
parentMerge pull request #11521 from patrasar/pimv6_drpriority (diff)
downloadfrr-500fe387a0e4ff474e3f85a317ac73f733dccf01.tar.xz
frr-500fe387a0e4ff474e3f85a317ac73f733dccf01.zip
bfdd: fix coverity scan resource leak
Close the descriptor if something fails and we don't return it. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd/bfd_packet.c')
-rw-r--r--bfdd/bfd_packet.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c
index 6b0afef65..23778c82d 100644
--- a/bfdd/bfd_packet.c
+++ b/bfdd/bfd_packet.c
@@ -1569,6 +1569,7 @@ int bp_echo_socket(const struct vrf *vrf)
-1) {
zlog_warn("%s: setsockopt(SO_ATTACH_FILTER): %s", __func__,
strerror(errno));
+ close(s);
return -1;
}
@@ -1579,6 +1580,7 @@ int bp_echo_socket(const struct vrf *vrf)
if (bind(s, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
zlog_warn("Failed to bind echo socket: %s",
safe_strerror(errno));
+ close(s);
return -1;
}