Import 2017-06-07 23:51:09: master a7125449

Author Committer Branch Timestamp Parent
jcfr jcfr master 2014-07-17 18:54:15 master 8ced1b90
Changeset

BUG: Fix memory initialization in vtkMRMLColorTableNode::SetNumberOfColors

This commit fixes a problem discovered while running the test
vtkMRMLColorTableNodeTest1 through valgrind. It basically ensures that
new table entry are initialized.

==26783== Conditional jump or move depends on uninitialised value(s)
==26783== at 0x23B631D3: __printf_fp (printf_fp.c:404)
==26783== by 0x23B62A9B: vfprintf (vfprintf.c:1654)
==26783== by 0x23B875A4: vsnprintf (vsnprintf.c:119)
==26783== by 0x2367E01F: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==26783== by 0x23684455: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, char, double) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==26783== by 0x2368473F: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==26783== by 0x2368FA34: std::ostream& std::ostream::_M_insert<double>(double) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==26783== by 0x511352D: vtkMRMLColorNode::SetNameFromColor(int) (vtkMRMLColorNode.cxx:312)
==26783== by 0x511336F: vtkMRMLColorNode::SetNamesFromColors() (vtkMRMLColorNode.cxx:295)
==26783== by 0x512245B: vtkMRMLColorTableNode::SetColor(int, char const*, double, double, double, double) (vtkMRMLColorTableNode.cxx:1301)
==26783== by 0x48750A: vtkMRMLColorTableNodeTest1(int, char**) (vtkMRMLColorTableNodeTest1.cxx:83)
==26783== by 0x47215C: main (MRMLCoreCxxTests.cxx:616)

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23447 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Libs/MRML/Core/vtkMRMLColorTableNode.cxx Diff File