]> git.proxmox.com Git - mirror_frr.git/commitdiff
bfdd: fix coverity scan resource leak
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 6 Jul 2022 10:49:56 +0000 (07:49 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 6 Jul 2022 10:49:56 +0000 (07:49 -0300)
Close the descriptor if something fails and we don't return it.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
bfdd/bfd_packet.c

index 6b0afef65fbe5bee43d6fd65a8ec3d6f4da96e21..23778c82d50045660b4ce379451254f9af2e1530 100644 (file)
@@ -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;
        }