summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2018-08-19 20:07:07 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2018-08-19 20:07:07 +0000
commit435259bf3cd64561bba759af91f8350da80171c8 (patch)
tree38df4ece9df1e5c96d5d46187cb81e8c12cf1757 /usr.bin
parent9c92624d8789b18539337dd0eafd42e87e386a64 (diff)
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 'usr.bin')
-rw-r--r--usr.bin/openssl/s_socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/openssl/s_socket.c b/usr.bin/openssl/s_socket.c
index d3aff1b3bb5..62b32d39363 100644
--- a/usr.bin/openssl/s_socket.c
+++ b/usr.bin/openssl/s_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_socket.c,v 1.9 2018/02/07 05:47:55 jsing Exp $ */
+/* $OpenBSD: s_socket.c,v 1.10 2018/08/19 20:07:06 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -276,11 +276,13 @@ do_accept(int acc_sock, int *sock, char **host)
if (h2 == NULL) {
BIO_printf(bio_err, "gethostbyname failure\n");
close(ret);
+ free(*host);
return (0);
}
if (h2->h_addrtype != AF_INET) {
BIO_printf(bio_err, "gethostbyname addr is not AF_INET\n");
close(ret);
+ free(*host);
return (0);
}
}