]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: When bind fails we could leave an open socket
authorDonald Sharp <sharpd@nvidia.com>
Thu, 24 Sep 2020 12:12:49 +0000 (08:12 -0400)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 6 Oct 2020 12:54:25 +0000 (15:54 +0300)
Clean up the rare situation when bind fails to not
close the fd that was just opened and have the socket
leaked.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
pimd/pim_igmp.c

index ed580d7539cbe3c69906a57dd4b7b9c63700ec62..04ece6dbb0d85787675de4fc28affa6de53e5b0e 100644 (file)
@@ -1013,6 +1013,8 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list,
        if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) != 0) {
                zlog_warn("Could not bind IGMP socket for %s on %s",
                          inet_ntoa(ifaddr), ifp->name);
+               close(fd);
+
                return NULL;
        }