BUG: Fix memory leak in vtkMRMLScene
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== 12 bytes in 1 blocks are definitely lost in loss record 264 of 2,311
==9195== at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9195== by 0xE596033: vtkMRMLScene::SetVersion(char const) (in /home/jcfr/Projects/Slicer-Debug/Slicer-build/bin/libMRMLCore.so)
==9195== by 0xE5816EE: vtkMRMLScene::vtkMRMLScene() (vtkMRMLScene.cxx:136)
==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)
==9195== by 0x406D30: main (Main.cxx:254)
==9195==
==9195== 12 bytes in 1 blocks are definitely lost in loss record 265 of 2,311
==9195== at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9195== by 0xE596033: vtkMRMLScene::SetVersion(char const) (in /home/jcfr/Projects/Slicer-Debug/Slicer-build/bin/libMRMLCore.so)
==9195== by 0xE5816EE: vtkMRMLScene::vtkMRMLScene() (vtkMRMLScene.cxx:136)
==9195== by 0xE58385A: vtkMRMLScene::New() (vtkMRMLScene.cxx:371)
==9195== by 0x10A0C2EE4: vtkSlicerUnitsLogic::vtkSlicerUnitsLogic() (vtkSlicerUnitsLogic.cxx:44)
==9195== by 0x10A0C2E44: vtkSlicerUnitsLogic::New() (vtkSlicerUnitsLogic.cxx:39)
==9195== by 0x109C31C11: qSlicerUnitsModule::createLogic() (qSlicerUnitsModule.cxx:156)
==9195== by 0x8E71641: qSlicerAbstractCoreModule::logic() (qSlicerAbstractCoreModule.cxx:280)
==9195== by 0x8E70C2D: qSlicerAbstractCoreModule::initialize(vtkSlicerApplicationLogic*) (qSlicerAbstractCoreModule.cxx:99)
==9195== by 0x8EA2AB1: qSlicerModuleFactoryManager::loadModule(QString const&, QString const&) (qSlicerModuleFactoryManager.cxx:170)
==9195== by 0x8EA2963: qSlicerModuleFactoryManager::loadModule(QString const&, QString const&) (qSlicerModuleFactoryManager.cxx:157)
==9195== by 0x8EA2963: qSlicerModuleFactoryManager::loadModule(QString const&, QString const&) (qSlicerModuleFactoryManager.cxx:157)
git-svn-id: http://svn.slicer.org/Slicer4/trunk@24446 3bd1e089-480b-0410-8dfb-8563597acbee |