diff options
author | logan <> | 2014-05-25 20:51:21 +0000 |
---|---|---|
committer | logan <> | 2014-05-25 20:51:21 +0000 |
commit | 479c0f2aed2401c3c2377e38a9d1308883fdde31 (patch) | |
tree | 5e5f031b45327aa4056e4f458ee57ae1ead9b9a7 /src | |
parent | 5374d5ebdc35b8586499ba2c3f3f2aa5b6125405 (diff) | |
download | openbsd-479c0f2aed2401c3c2377e38a9d1308883fdde31.tar.gz openbsd-479c0f2aed2401c3c2377e38a9d1308883fdde31.tar.bz2 openbsd-479c0f2aed2401c3c2377e38a9d1308883fdde31.zip |
Fix resource descriptor leaks.
CID: 966576 & 966577
OK from guenther@ and "Yup. looks good." from tedu@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/src/apps/s_socket.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/libssl/src/apps/s_socket.c b/src/lib/libssl/src/apps/s_socket.c index ca685684cf..d825fd73a5 100644 --- a/src/lib/libssl/src/apps/s_socket.c +++ b/src/lib/libssl/src/apps/s_socket.c | |||
@@ -122,6 +122,7 @@ init_client(int *sock, char *host, char *port, int type, int af) | |||
122 | (char *) &i, sizeof(i)); | 122 | (char *) &i, sizeof(i)); |
123 | if (i < 0) { | 123 | if (i < 0) { |
124 | perror("keepalive"); | 124 | perror("keepalive"); |
125 | close(s); | ||
125 | return (0); | 126 | return (0); |
126 | } | 127 | } |
127 | } | 128 | } |
@@ -281,16 +282,19 @@ redoit: | |||
281 | } else { | 282 | } else { |
282 | if ((*host = strdup(h1->h_name)) == NULL) { | 283 | if ((*host = strdup(h1->h_name)) == NULL) { |
283 | perror("strdup"); | 284 | perror("strdup"); |
285 | close(ret); | ||
284 | return (0); | 286 | return (0); |
285 | } | 287 | } |
286 | 288 | ||
287 | h2 = gethostbyname(*host); | 289 | h2 = gethostbyname(*host); |
288 | if (h2 == NULL) { | 290 | if (h2 == NULL) { |
289 | BIO_printf(bio_err, "gethostbyname failure\n"); | 291 | BIO_printf(bio_err, "gethostbyname failure\n"); |
292 | close(ret); | ||
290 | return (0); | 293 | return (0); |
291 | } | 294 | } |
292 | if (h2->h_addrtype != AF_INET) { | 295 | if (h2->h_addrtype != AF_INET) { |
293 | BIO_printf(bio_err, "gethostbyname addr is not AF_INET\n"); | 296 | BIO_printf(bio_err, "gethostbyname addr is not AF_INET\n"); |
297 | close(ret); | ||
294 | return (0); | 298 | return (0); |
295 | } | 299 | } |
296 | } | 300 | } |