mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
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.
This commit is contained in:
parent
2590d733f4
commit
df3812ede1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user