fix file descriptor leak if bind_peer fails

This commit is contained in:
Yves Rutschle 2023-05-13 23:18:07 +02:00
parent 5666a1bb9d
commit 3707c5b8a6

View File

@ -348,6 +348,7 @@ int connect_addr(struct connection *cnx, int fd_from, connect_blocking blocking)
if (transparent) {
res = bind_peer(fd, fd_from);
if (res == -1) close(fd);
CHECK_RES_RETURN(res, "bind_peer", res);
}
res = connect(fd, a->ai_addr, a->ai_addrlen);