Opened 9 years ago
Closed 9 years ago
#8530 closed Bugs (fixed)
[Coverity] Unused variable thread_handle, uninitialized variable cond_mutex in thread/pthread/thread_data.hpp
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.54.0 | Component: | thread |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
This was found in an older release, but is still present in trunk.
Coverity complains
134 thread_data_base(): 135 done(false),join_started(false),joined(false), 136 thread_exit_callbacks(0), 137 current_cond(0), 138 notify(), 139 async_states_() 140 //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS 141 , interrupt_enabled(true) 142 , interrupt_requested(false) 143 //#endif
(2) Event uninit_member: Non-static class member "thread_handle" is not initialized in this constructor nor in any functions
that it calls.
(4) Event uninit_member: Non-static class member "cond_mutex" is not initialized in this constructor nor in any functions
that it calls.
Initializing the two fields to zero seems reasonable, and makes coverity happy.
To repeat (assuming you have a coverity license, and bjam in $HOME/local/bin):
PATH=/opt/coverity/cov-analysis-linux64-6.5.1/bin:$HOME/local/bin:$PATH cov-configure --gcc rm -rf covlog mkdir -p covlog cov-build --dir covlog bjam t_threads cov-analyze --dir covlog cov-format-errors --dir covlog find covlog -type f | xargs grep cond_mutex.*not.*init find covlog -type f | xargs grep thread_handle.*not.*init
If grep finds anything, you've got the problem.
The attached patch makes the greps not find anything.
Attachments (1)
Change History (6)
by , 9 years ago
Attachment: | boost-pthread-data.patch added |
---|
comment:2 by , 9 years ago
Description: | modified (diff) |
---|
comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Draft patch to initialize the affected member variables