Import 2017-06-07 23:51:09: master 04c3069f

Author Committer Branch Timestamp Parent
jcfr jcfr master 2015-07-17 01:00:43 master 3dba92ad
Changeset

BUG: Fix memory leak in vtkMRMLSubjectHierarchyNode

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:

==29339== 6 bytes in 1 blocks are definitely lost in loss record 24 of 2,448
==29339== at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==29339== by 0x10599640D: vtkMRMLSubjectHierarchyNode::SetLevel(char const) (in /home/jcfr/Projects/Slicer-Debug/Slicer-build/lib/Slicer-4.4/qt-loadable-modules/libvtkSlicerSubjectHierarchyModuleMRML.so)
==29339== by 0x10598C253: vtkMRMLSubjectHierarchyNode::vtkMRMLSubjectHierarchyNode() (vtkMRMLSubjectHierarchyNode.cxx:60)
==29339== by 0x10598C144: vtkMRMLSubjectHierarchyNode::New() (vtkMRMLSubjectHierarchyNode.cxx:52)
==29339== by 0x108325A18: vtkSmartPointer<vtkMRMLSubjectHierarchyNode>::New() (vtkSmartPointer.h:117)
==29339== by 0x1083235AC: vtkSlicerSubjectHierarchyModuleLogic::RegisterNodes() (vtkSlicerSubjectHierarchyModuleLogic.cxx:73)
==29339== by 0x982B519: vtkMRMLAbstractLogic::SetMRMLScene(vtkMRMLScene
) (vtkMRMLAbstractLogic.cxx:285)
==29339== by 0x8E70F0A: qSlicerAbstractCoreModule::setMRMLScene(vtkMRMLScene*) (qSlicerAbstractCoreModule.cxx:168)
==29339== by 0x8EA2B1A: qSlicerModuleFactoryManager::loadModule(QString const&, QString const&) (qSlicerModuleFactoryManager.cxx:181)
==29339== by 0x8EA2586: qSlicerModuleFactoryManager::loadModule(QString const&) (qSlicerModuleFactoryManager.cxx:110)
==29339== by 0x40672A: (anonymous namespace)::SlicerAppMain(int, char**) (Main.cxx:193)
==29339== by 0x406D30: main (Main.cxx:254)

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

mod - Modules/Loadable/SubjectHierarchy/MRML/vtkMRMLSubjectHierarchyNode.cxx Diff File