client_to_gw_tun calls setsockopt which can fail. In this case it jumps to the error handling and cleanup code but doesn't close the udp_sock. This has to be done to avoid leaking of file descriptors.
Signed-off-by: Sven Eckelmann sven@narfation.org --- posix/tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/posix/tunnel.c b/posix/tunnel.c index 08c56a2..8e7611b 100644 --- a/posix/tunnel.c +++ b/posix/tunnel.c @@ -201,7 +201,7 @@ void *client_to_gw_tun(void *arg) sock_opts = 1; if (setsockopt(udp_sock, SOL_SOCKET, SO_REUSEADDR, &sock_opts, sizeof(sock_opts)) < 0) { debug_output(0, "Error - can't set options on udp socket: %s\n", strerror(errno)); - goto out; + goto udp_out; }
if (bind(udp_sock, (struct sockaddr *)&my_addr, sizeof(struct sockaddr_in)) < 0) {