Skip to content

Commit 987de04

Browse files
committed
Free the cached MC tracks in the MCKinematicsReader destructor
This fixes a memory leak in the MCKinematicsReader destructor. - The destructor never deleted the per-event track vectors that are still cached.
1 parent eeaf095 commit 987de04

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎Steer/src/MCKinematicsReader.cxx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ void MCKinematicsReader::ensureTracksForSourceAndEvent(int source, int event) co
4343

4444
MCKinematicsReader::~MCKinematicsReader()
4545
{
46+
for (auto& perSource : mTracks) {
47+
for (auto tracks : perSource) {
48+
delete tracks;
49+
}
50+
}
51+
mTracks.clear();
52+
4653
for (auto chain : mInputChains) {
4754
delete chain;
4855
}

0 commit comments

Comments
 (0)