pimd: When bind fails we could leave an open socket

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>
This commit is contained in:
Donald Sharp 2020-09-24 08:12:49 -04:00
parent d12f46fa1a
commit 2c85fdd4c3

View 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;
}