[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] rng_test_helpers: add a needless lock/unlock pair to please coverity



commit 1bf451cffba5da84166dda48ec957e0b9cf45bee
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu May 16 15:03:54 2019 -0400

    rng_test_helpers: add a needless lock/unlock pair to please coverity
    
    Fix for CID 1444908
---
 src/test/rng_test_helpers.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/test/rng_test_helpers.c b/src/test/rng_test_helpers.c
index 262d380bd..04b713847 100644
--- a/src/test/rng_test_helpers.c
+++ b/src/test/rng_test_helpers.c
@@ -183,11 +183,14 @@ void
 testing_enable_prefilled_rng(const void *buffer, size_t buflen)
 {
   tor_assert(buflen > 0);
+  tor_assert(!rng_mutex);
   rng_mutex = tor_mutex_new();
 
+  tor_mutex_acquire(rng_mutex);
   prefilled_rng_buffer = tor_memdup(buffer, buflen);
   prefilled_rng_buflen = buflen;
   prefilled_rng_idx = 0;
+  tor_mutex_release(rng_mutex);
 
   MOCK(crypto_rand, crypto_rand_prefilled);
   MOCK(crypto_strongest_rand_, mock_crypto_strongest_rand);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits