diff options
author | matteo <matteo@FreeBSD.org> | 2007-10-23 07:35:17 +0000 |
---|---|---|
committer | matteo <matteo@FreeBSD.org> | 2007-10-23 07:35:17 +0000 |
commit | 7269c46635acddb542b968e3b0d660cad1e5ae18 (patch) | |
tree | ecfb71da5e0c9648f52d688ec7df78a7b708b20e | |
parent | 0daece515be7eb3ce08cf164fdd7510fb61951e5 (diff) | |
download | FreeBSD-src-7269c46635acddb542b968e3b0d660cad1e5ae18.zip FreeBSD-src-7269c46635acddb542b968e3b0d660cad1e5ae18.tar.gz |
Avoid leaking file descriptors
-rw-r--r-- | usr.sbin/rpcbind/rpcbind.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c index 2fe3c41..c1f5603 100644 --- a/usr.sbin/rpcbind/rpcbind.c +++ b/usr.sbin/rpcbind/rpcbind.c @@ -365,8 +365,10 @@ init_transport(struct netconfig *nconf) * Skip if we have an AF_INET6 adress. */ if (inet_pton(AF_INET6, - hosts[nhostsbak], host_addr) == 1) + hosts[nhostsbak], host_addr) == 1) { + close(fd); continue; + } } break; case AF_INET6: @@ -378,8 +380,10 @@ init_transport(struct netconfig *nconf) * Skip if we have an AF_INET adress. */ if (inet_pton(AF_INET, hosts[nhostsbak], - host_addr) == 1) - continue; + host_addr) == 1) { + close(fd); + continue; + } } if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof on) < 0) { |