summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
authortb <>2018-08-19 20:07:06 +0000
committertb <>2018-08-19 20:07:06 +0000
commitc27ef471eb0aec48d659006b6824c47b96405f3c (patch)
tree2fbb678b11abe2316f790b5da4df1e680b37c0b1 /src/usr.bin
parent20ae7f1462fc960cd8c12d1f0c14465997d0dc2a (diff)
downloadopenbsd-c27ef471eb0aec48d659006b6824c47b96405f3c.tar.gz
openbsd-c27ef471eb0aec48d659006b6824c47b96405f3c.tar.bz2
openbsd-c27ef471eb0aec48d659006b6824c47b96405f3c.zip
Don't leak a strdup()'ed string on error in do_accept().
CID #154702. input & ok inoguchi, ok mestre on first version
Diffstat (limited to 'src/usr.bin')
-rw-r--r--src/usr.bin/openssl/s_socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c
index d3aff1b3bb..62b32d3936 100644
--- a/src/usr.bin/openssl/s_socket.c
+++ b/src/usr.bin/openssl/s_socket.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_socket.c,v 1.9 2018/02/07 05:47:55 jsing Exp $ */ 1/* $OpenBSD: s_socket.c,v 1.10 2018/08/19 20:07:06 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -276,11 +276,13 @@ do_accept(int acc_sock, int *sock, char **host)
276 if (h2 == NULL) { 276 if (h2 == NULL) {
277 BIO_printf(bio_err, "gethostbyname failure\n"); 277 BIO_printf(bio_err, "gethostbyname failure\n");
278 close(ret); 278 close(ret);
279 free(*host);
279 return (0); 280 return (0);
280 } 281 }
281 if (h2->h_addrtype != AF_INET) { 282 if (h2->h_addrtype != AF_INET) {
282 BIO_printf(bio_err, "gethostbyname addr is not AF_INET\n"); 283 BIO_printf(bio_err, "gethostbyname addr is not AF_INET\n");
283 close(ret); 284 close(ret);
285 free(*host);
284 return (0); 286 return (0);
285 } 287 }
286 } 288 }