commit 2141bbfe5c07e96a76ff3a40459eef23384ae19e
parent 6ce80b48d783b5c8cbc94a766fd339ef78c97632
Author: sin <sin@2f30.org>
Date: Wed, 23 Mar 2016 17:01:10 +0000
avoid fd leak
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/stun.c b/stun.c
@@ -586,6 +586,7 @@ clientsetup(int devfd)
}
freeaddrinfo(ai);
if (!p) {
+ close(netfd);
logwarn("failed to connect to %s:%s", host, port);
return -1;
}
@@ -594,6 +595,7 @@ clientsetup(int devfd)
ret = response(netfd);
if (ret < 0) {
+ close(netfd);
logwarn("failed to respond to challenge");
return -1;
}