Menu

#5 Member variables not initialized in constructor

open
General (5)
5
2009-11-03
2009-11-03
Mikel Astiz
No

The size of the vectors is not initialized in the class constructors, in kfilter_impl.hpp. Although "flags" is set to 0, member variables that hold the sizes of the vectors are not initialized in the constructor, which can lead to crashes. This can be easily reproduced if you make a test within a loop, where the filter is instantiated repeatedly inside the loop (and, of course, destroyed too). At the beginning of the second iteration the program crashes because the mentioned member variables still hold the values used in the previous iteratior (compiler optimization issues, I guess -- gcc under Linux), as opposite to what is expected in the code (which assumes all those variables are initialized to 0).

Discussion


Log in to post a comment.