- djm@cvs.openbsd.org 2003/05/23 08:29:30

[sshconnect.c]
     fix leak; ok markus@
This commit is contained in:
Damien Miller 2003-05-23 18:44:41 +10:00
parent fbf486b4a6
commit 08293fa435
2 changed files with 13 additions and 8 deletions

View File

@ -11,6 +11,9 @@
- jmc@cvs.openbsd.org 2003/05/20 12:09:31 - jmc@cvs.openbsd.org 2003/05/20 12:09:31
[ssh.1 ssh_config.5 sshd.8 sshd_config.5 ssh-keygen.1] [ssh.1 ssh_config.5 sshd.8 sshd_config.5 ssh-keygen.1]
new sentence, new line new sentence, new line
- djm@cvs.openbsd.org 2003/05/23 08:29:30
[sshconnect.c]
fix leak; ok markus@
20030520 20030520
- (djm) OpenBSD CVS Sync - (djm) OpenBSD CVS Sync
@ -1599,4 +1602,4 @@
save auth method before monitor_reset_key_state(); bugzilla bug #284; save auth method before monitor_reset_key_state(); bugzilla bug #284;
ok provos@ ok provos@
$Id: ChangeLog,v 1.2747 2003/05/23 08:44:23 djm Exp $ $Id: ChangeLog,v 1.2748 2003/05/23 08:44:41 djm Exp $

View File

@ -13,7 +13,7 @@
*/ */
#include "includes.h" #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> #include <openssl/bn.h>
@ -225,7 +225,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
fd_set *fdset; fd_set *fdset;
struct timeval tv; struct timeval tv;
socklen_t optlen; socklen_t optlen;
int fdsetsz, optval, rc; int fdsetsz, optval, rc, result = -1;
if (timeout <= 0) if (timeout <= 0)
return (connect(sockfd, serv_addr, addrlen)); return (connect(sockfd, serv_addr, addrlen));
@ -257,11 +257,11 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
case 0: case 0:
/* Timed out */ /* Timed out */
errno = ETIMEDOUT; errno = ETIMEDOUT;
return (-1); break;
case -1: case -1:
/* Select error */ /* Select error */
debug("select: %s", strerror(errno)); debug("select: %s", strerror(errno));
return (-1); break;
case 1: case 1:
/* Completed or failed */ /* Completed or failed */
optval = 0; optval = 0;
@ -269,18 +269,20 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval,
&optlen) == -1) &optlen) == -1)
debug("getsockopt: %s", strerror(errno)); debug("getsockopt: %s", strerror(errno));
return (-1); break;
if (optval != 0) { if (optval != 0) {
errno = optval; errno = optval;
return (-1); break;
} }
result = 0;
break; break;
default: default:
/* Should not occur */ /* Should not occur */
fatal("Bogus return (%d) from select()", rc); fatal("Bogus return (%d) from select()", rc);
} }
return (0); xfree(fdset);
return (result);
} }
/* /*