MRtrix3 / mrtrix3

MRtrix3 provides a set of tools to perform various advanced diffusion MRI analyses, including constrained spherical deconvolution (CSD), probabilistic tractography, track-density imaging, and apparent fibre density
http://www.mrtrix.org
Mozilla Public License 2.0
295 stars 182 forks source link

Fix memory leak in sh2peaks #2760

Closed daljit46 closed 10 months ago

daljit46 commented 1 year ago

This was found using Address Sanitizer on the dev branch. The Processor class defined in sh2peaks.cpp allocated its precomputer member variable on the heap using a raw pointer. The allocated memory was never freed, leading to a memory leak. The fix allocates the memory using a shared_ptr (unique_ptr wasn't used as we need our functors to be copyable for multithreaded purposes).

github-actions[bot] commented 1 year ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 10 months ago

clang-tidy review says "All clean, LGTM! :+1:"