>From 151cc7b47ebf8530c0357ddc909cea5c070fb023 Mon Sep 17 00:00:00 2001
From: Rolf Eike Beer <[email protected]>
Date: Thu, 18 Sep 2014 11:12:10 +0200
Subject: [PATCH] make locking code in load_builtin_compressions() look less
scary
This way it is obvious that read and write locks are not mixed.
---
ssl/ssl_ciph.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
index 8188ff5..ffcef37 100644
--- a/ssl/ssl_ciph.c
+++ b/ssl/ssl_ciph.c
@@ -441,15 +441,12 @@ static int sk_comp_cmp(const SSL_COMP * const *a,
static void load_builtin_compressions(void)
{
- int got_write_lock = 0;
-
CRYPTO_r_lock(CRYPTO_LOCK_SSL);
if (ssl_comp_methods == NULL)
{
CRYPTO_r_unlock(CRYPTO_LOCK_SSL);
CRYPTO_w_lock(CRYPTO_LOCK_SSL);
- got_write_lock = 1;
-
+
if (ssl_comp_methods == NULL)
{
SSL_COMP *comp = NULL;
@@ -476,10 +473,8 @@ static void load_builtin_compressions(void)
}
MemCheck_on();
}
- }
-
- if (got_write_lock)
CRYPTO_w_unlock(CRYPTO_LOCK_SSL);
+ }
else
CRYPTO_r_unlock(CRYPTO_LOCK_SSL);
}
--
1.8.1.4
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [email protected]