Skip to content

Commit

Permalink
Fix memory leak when filtering particleIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Jun 24, 2024
1 parent e332b68 commit 50e0aca
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ struct RecoParticleIDFilterAccessor : public IMPL::ReconstructedParticleImpl {
auto lastIt =
std::remove_if(_pid.begin(), _pid.end(), [algoId](const auto& pid) { return (pid->getAlgorithmType() == algoId); });

// We have to take care of cleanup in this case!
std::for_each(lastIt, _pid.end(), [](auto& p) { delete p; });
_pid.erase(lastIt, _pid.end());
}
};
Expand Down

0 comments on commit 50e0aca

Please sign in to comment.