summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libtls/tls_client.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_client.c b/src/lib/libtls/tls_client.c
index 68b0f32226..6bb24cd512 100644
--- a/src/lib/libtls/tls_client.c
+++ b/src/lib/libtls/tls_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_client.c,v 1.31 2015/10/08 20:13:45 guenther Exp $ */ 1/* $OpenBSD: tls_client.c,v 1.32 2015/10/09 04:13:34 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -118,6 +118,7 @@ tls_connect_servername(struct tls *ctx, const char *host, const char *port,
118 } 118 }
119 119
120 /* It was resolved somehow; now try connecting to what we got */ 120 /* It was resolved somehow; now try connecting to what we got */
121 s = -1;
121 for (res = res0; res; res = res->ai_next) { 122 for (res = res0; res; res = res->ai_next) {
122 s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); 123 s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
123 if (s == -1) { 124 if (s == -1) {
@@ -135,6 +136,9 @@ tls_connect_servername(struct tls *ctx, const char *host, const char *port,
135 } 136 }
136 freeaddrinfo(res0); 137 freeaddrinfo(res0);
137 138
139 if (s == -1)
140 goto err;
141
138 if (servername == NULL) 142 if (servername == NULL)
139 servername = h; 143 servername = h;
140 144