BUG: Fix memory leak in vtkMRMLDisplayNode
This commit fixes the error(s) reported below by valgrind memcheck tool.
Valgrind was used on Ubuntu 14.04 against a Debug build of Slicer. It was
exected doing the following:
(1) Start a terminal with the appropriate environment: ./Slicer --gnome-terminal
(2) Start Slicer using valgrind: valgrind --log-file=2015-07-16-Slicer-memcheck.txt --tool=memcheck --leak-check=yes ./bin/SlicerApp-real --disable-python --disable-cli-modules
(3) Exit Slicer and inspect valgrind log file
Valgrind error:
==9195== 22 bytes in 1 blocks are definitely lost in loss record 407 of 2,311
==9195== at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9195== by 0xE443C13: vtkMRMLDisplayNode::SetActiveScalarName(char const*) (vtkMRMLDisplayNode.cxx:38)
==9195== by 0xE6A1650: vtkMRMLTransformDisplayNode::vtkMRMLTransformDisplayNode() (vtkMRMLTransformDisplayNode.cxx:62)
==9195== by 0xE6A153A: vtkMRMLTransformDisplayNode::New() (vtkMRMLTransformDisplayNode.cxx:50)
==9195== by 0xE5990EC: vtkSmartPointer<vtkMRMLTransformDisplayNode>::New() (vtkSmartPointer.h:117)
==9195== by 0xE582342: vtkMRMLScene::vtkMRMLScene() (vtkMRMLScene.cxx:201)
==9195== by 0xE58385A: vtkMRMLScene::New() (vtkMRMLScene.cxx:371)
==9195== by 0x5602843: vtkNew<vtkMRMLScene>::vtkNew() (vtkNew.h:66)
==9195== by 0x8E82E96: qSlicerCoreApplicationPrivate::init() (qSlicerCoreApplication.cxx:266)
==9195== by 0x59272A7: qSlicerApplicationPrivate::init() (qSlicerApplication.cxx:180)
==9195== by 0x5927FDF: qSlicerApplication::qSlicerApplication(int&, char) (qSlicerApplication.cxx:319)
==9195== by 0x406039: (anonymous namespace)::SlicerAppMain(int, char) (Main.cxx:125)
git-svn-id: http://svn.slicer.org/Slicer4/trunk@24447 3bd1e089-480b-0410-8dfb-8563597acbee |