diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-01-25 14:12:37 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-01-25 14:12:37 -0500 |
commit | df3812ede144d7bc8dd15f84497b09f39c850157 (patch) | |
tree | 20b885eff83fb4a46fd2a81efdbfc46bb7ea2711 /src | |
parent | 2590d733f4f3c6968bcdcb9880875ea90295ea80 (diff) | |
download | tor-df3812ede144d7bc8dd15f84497b09f39c850157.tar.gz tor-df3812ede144d7bc8dd15f84497b09f39c850157.zip |
Rearrange _thread_test_func to please Coverity Scan
I believe that since we were allocating *cp while holding a mutex,
coverity deduced that *cp must be protected by that mutex, and later
flipped out when we didn't use it that way. If this is so, we can
solve our problems by moving the *cp = tor_strdup(buf) part outside of
the mutex-protected code.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/test_util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index ba0f8cdf2d..ad8d82b4c0 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -420,11 +420,12 @@ _thread_test_func(void* _s) cp = &_thread2_name; count = &t2_count; } - tor_mutex_acquire(m); tor_snprintf(buf, sizeof(buf), "%lu", tor_get_thread_id()); *cp = tor_strdup(buf); + tor_mutex_acquire(m); + for (i=0; i<10000; ++i) { tor_mutex_acquire(_thread_test_mutex); strmap_set(_thread_test_strmap, "last to run", *cp); |