diff options
author | 2003-05-23 08:29:30 +0000 | |
---|---|---|
committer | 2003-05-23 08:29:30 +0000 | |
commit | 4e2a195f2e9ff8300cfa7f18d8ef2c17a6a4650b (patch) | |
tree | d5e2aaca99e5f754dcb8d0b2c2aeb59ee5c72089 | |
parent | don't #ifdef within struct tcpcb definition, as it is used in userland too. (diff) | |
download | wireguard-openbsd-4e2a195f2e9ff8300cfa7f18d8ef2c17a6a4650b.tar.xz wireguard-openbsd-4e2a195f2e9ff8300cfa7f18d8ef2c17a6a4650b.zip |
fix leak; ok markus@
-rw-r--r-- | usr.bin/ssh/sshconnect.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index cfc492f5337..8ae6a70be2b 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.141 2003/05/15 14:55:25 djm Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.142 2003/05/23 08:29:30 djm Exp $"); #include <openssl/bn.h> @@ -221,7 +221,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, fd_set *fdset; struct timeval tv; socklen_t optlen; - int fdsetsz, optval, rc; + int fdsetsz, optval, rc, result = -1; if (timeout <= 0) return (connect(sockfd, serv_addr, addrlen)); @@ -253,11 +253,11 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, case 0: /* Timed out */ errno = ETIMEDOUT; - return (-1); + break; case -1: /* Select error */ debug("select: %s", strerror(errno)); - return (-1); + break; case 1: /* Completed or failed */ optval = 0; @@ -265,18 +265,20 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, &optlen) == -1) debug("getsockopt: %s", strerror(errno)); - return (-1); + break; if (optval != 0) { errno = optval; - return (-1); + break; } + result = 0; break; default: /* Should not occur */ fatal("Bogus return (%d) from select()", rc); } - return (0); + xfree(fdset); + return (result); } /* |