star-bnl / star-sw

Core software for STAR experiment
26 stars 63 forks source link

Fix memory leak in StFstClusterMaker #593

Closed techuan-huang closed 7 months ago

techuan-huang commented 7 months ago

Memory leaks were found by Gene in issue #590. There are 3 places causing the leak in StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx:

  1. Pointers assigned to std::vector in line 55 were not deleted before calling std::vector::pop_back() in line 69 and line 80.
  2. Object created in line 140 but only conditionally assigned to a std::vector in line 148.
  3. In line 203, std::vector::erase() was called without deleting the pointers.

After fixing these places, there is no memory leak from StFstClusterMaker reported by valgrind.