mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
211 stars 124 forks source link

Fix the obvous memory leaks shown by cppcheck #4858

Closed martyngigg closed 9 years ago

martyngigg commented 13 years ago

When setting up the Jenkins cppcheck it gave some very obvious memory leaks

Code/Mantid/Framework/CurveFitting/src/Convolution.cpp  86  memleak error   Memory leak: xr
Code/Mantid/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp  594 memleak error   Memory leak: tof_data
Code/Mantid/MantidPlot/src/FFT.cpp  101 memleak error   Memory leak: amp
Code/Mantid/MantidPlot/src/Interpolation.cpp    182 memleak error   Memory leak: ytemp
Code/Mantid/MantidPlot/src/Interpolation.cpp    182 memleak error   Memory leak: xtemp
Code/Mantid/Vates/VatesAPI/src/vtkThresholdingHexahedronFactory.cpp 284 memleak error   Memory leak: pointIDs
Code/Mantid/Vates/VatesAPI/src/vtkThresholdingHexahedronFactory.cpp 284 memleak error   Memory leak: voxelShown
Code/Mantid/Vates/VatesAPI/src/vtkThresholdingHexahedronFactory.cpp 284 memleak error   Memory leak: pointNeeded
Code/Mantid/Vates/VatesAPI/src/vtkThresholdingQuadFactory.cpp   200 memleak error   Memory leak: pointIDs
Code/Mantid/Vates/VatesAPI/src/vtkThresholdingQuadFactory.cpp   200 memleak error   Memory leak: voxelShown
Code/Mantid/Vates/VatesAPI/src/vtkThresholdingQuadFactory.cpp   200 memleak error   Memory leak: pointNeeded
Code/Mantid/Framework/CurveFitting/src/Convolution.cpp  196 mismatchAllocDealloc    error   Mismatching allocation and deallocation: tmp
Code/Mantid/Framework/DataHandling/src/SaveISISNexus.cpp    363 mismatchAllocDealloc    error   Mismatching allocation and deallocation: buff

They are easy to fix as cppcheck gives the exact line where the leak happens.

martyngigg commented 9 years ago

This issue was originally trac ticket 4011