From a01461da99894034f579bea7f1983da75e53c3cb Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 11 Dec 2002 08:56:38 +0000 Subject: [PATCH] In CRYPTO_lock(), check that the application cares about locking (provided callbacks) before attempting to lock. --- crypto/cryptlib.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index e0e7bb1d26..aa87ffd6ec 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -409,18 +409,17 @@ void CRYPTO_lock(int mode, int type, const char *file, int line) #endif if (type < 0) { - int i = -type - 1; - struct CRYPTO_dynlock_value *pointer - = CRYPTO_get_dynlock_value(i); + if (dynlock_lock_callback != NULL) + { + struct CRYPTO_dynlock_value *pointer + = CRYPTO_get_dynlock_value(type); - assert(pointer != NULL); + assert(pointer != NULL); - if (dynlock_lock_callback) - { dynlock_lock_callback(mode, pointer, file, line); - } - CRYPTO_destroy_dynlockid(i); + CRYPTO_destroy_dynlockid(type); + } } else if (locking_callback != NULL) -- 2.25.1