test: fix coverity 1451562: resource leak

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14596)
This commit is contained in:
Pauli 2021-03-18 10:29:05 +10:00
parent b573d0ceea
commit 743840d56f

View File

@ -93,14 +93,14 @@ static int wait_for_thread(thread_t thread)
static int test_lock(void)
{
CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();
int res;
if (!TEST_true(CRYPTO_THREAD_read_lock(lock))
|| !TEST_true(CRYPTO_THREAD_unlock(lock)))
return 0;
res = TEST_true(CRYPTO_THREAD_read_lock(lock))
&& TEST_true(CRYPTO_THREAD_unlock(lock));
CRYPTO_THREAD_lock_free(lock);
return 1;
return res;
}
static CRYPTO_ONCE once_run = CRYPTO_ONCE_STATIC_INIT;