[tor-commits] [tor/master] Fix coverity cid 1405509

nickm at torproject.org nickm at torproject.org
Wed Apr 26 12:48:27 UTC 2017


commit 71c8974af0570f3a2fe1ea5ca77e3a61873558bd
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Wed Apr 26 08:48:24 2017 +0200

    Fix coverity cid 1405509
    
    Locking in the init function is not necessary, but coverity gets
    confused about it. So let's trick it.
---
 src/common/compat_threads.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/common/compat_threads.c b/src/common/compat_threads.c
index d3f64f2..c593e9a 100644
--- a/src/common/compat_threads.c
+++ b/src/common/compat_threads.c
@@ -362,8 +362,8 @@ alert_sockets_close(alert_sockets_t *socks)
 void
 atomic_counter_init(atomic_counter_t *counter)
 {
+  memset(counter, 0, sizeof(*counter));
   tor_mutex_init_nonrecursive(&counter->mutex);
-  counter->val = 0;
 }
 /** Clean up all resources held by an atomic counter. */
 void



More information about the tor-commits mailing list