From 1647f9e5bf430e0c04a75ecc1f7e37ba5e29fa4f Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 16 Jul 2014 10:43:06 +0000 Subject: [PATCH] do not need a variable to track locking, since all code paths have it locked throughout. --- lib/libcrypto/bio/b_sock.c | 7 ++----- lib/libssl/src/crypto/bio/b_sock.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/libcrypto/bio/b_sock.c b/lib/libcrypto/bio/b_sock.c index ced0406bc15..c095943e8b9 100644 --- a/lib/libcrypto/bio/b_sock.c +++ b/lib/libcrypto/bio/b_sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_sock.c,v 1.55 2014/07/13 16:03:09 beck Exp $ */ +/* $OpenBSD: b_sock.c,v 1.56 2014/07/16 10:43:06 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -80,7 +80,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip) { int i; int err = 1; - int locked = 0; struct hostent *he; if (inet_pton(AF_INET, str, ip) == 1) @@ -88,7 +87,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip) /* do a gethostbyname */ CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); - locked = 1; he = BIO_gethostbyname(str); if (he == NULL) { BIOerr(BIO_F_BIO_GET_HOST_IP, BIO_R_BAD_HOSTNAME_LOOKUP); @@ -106,8 +104,7 @@ BIO_get_host_ip(const char *str, unsigned char *ip) err = 0; err: - if (locked) - CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); + CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); if (err) { ERR_asprintf_error_data("host=%s", str); return 0; diff --git a/lib/libssl/src/crypto/bio/b_sock.c b/lib/libssl/src/crypto/bio/b_sock.c index ced0406bc15..c095943e8b9 100644 --- a/lib/libssl/src/crypto/bio/b_sock.c +++ b/lib/libssl/src/crypto/bio/b_sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_sock.c,v 1.55 2014/07/13 16:03:09 beck Exp $ */ +/* $OpenBSD: b_sock.c,v 1.56 2014/07/16 10:43:06 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -80,7 +80,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip) { int i; int err = 1; - int locked = 0; struct hostent *he; if (inet_pton(AF_INET, str, ip) == 1) @@ -88,7 +87,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip) /* do a gethostbyname */ CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); - locked = 1; he = BIO_gethostbyname(str); if (he == NULL) { BIOerr(BIO_F_BIO_GET_HOST_IP, BIO_R_BAD_HOSTNAME_LOOKUP); @@ -106,8 +104,7 @@ BIO_get_host_ip(const char *str, unsigned char *ip) err = 0; err: - if (locked) - CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); + CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); if (err) { ERR_asprintf_error_data("host=%s", str); return 0; -- 2.20.1