summaryrefslogtreecommitdiffstats
path: root/test/threadstest.c
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-18 10:29:05 +1000
committerPauli <ppzgs1@gmail.com>2021-03-20 10:07:59 +1000
commit743840d56f165a56b1c4b1e50ce1e8062e49345a (patch)
treea8ad198474fe81b8d2029f82ce2cdad8712bcfed /test/threadstest.c
parentb573d0ceea8aa85ec6cb1e4609452f5cc405dfc8 (diff)
test: fix coverity 1451562: resource leak
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14596)
Diffstat (limited to 'test/threadstest.c')
-rw-r--r--test/threadstest.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/threadstest.c b/test/threadstest.c
index 5b64246881..ed46234fc1 100644
--- a/test/threadstest.c
+++ b/test/threadstest.c
@@ -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;