Skip to content

Commit f00a113

Browse files
committed
Fixed memory leak in RegionalMuonGMTUnpacker
1 parent 99becea commit f00a113

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,14 @@ namespace l1t {
3434
unsigned int linkId = blockId / 2;
3535
int processor;
3636
RegionalMuonCandBxCollection* regionalMuonCollection;
37-
RegionalMuonShowerBxCollection* regionalMuonShowerCollection;
37+
RegionalMuonShowerBxCollection* regionalMuonShowerCollection = nullptr;
3838
tftype trackFinder;
3939
if (linkId > 47 && linkId < 60) {
4040
regionalMuonCollection = static_cast<GMTCollections*>(coll)->getRegionalMuonCandsBMTF();
41-
regionalMuonShowerCollection =
42-
new RegionalMuonShowerBxCollection(); // To avoid warning re uninitialised collection
4341
trackFinder = tftype::bmtf;
4442
processor = linkId - 48;
4543
} else if (linkId > 41 && linkId < 66) {
4644
regionalMuonCollection = static_cast<GMTCollections*>(coll)->getRegionalMuonCandsOMTF();
47-
regionalMuonShowerCollection =
48-
new RegionalMuonShowerBxCollection(); // To avoid warning re uninitialised collection
4945
if (linkId < 48) {
5046
trackFinder = tftype::omtf_pos;
5147
processor = linkId - 42;
@@ -68,8 +64,9 @@ namespace l1t {
6864
return false;
6965
}
7066
regionalMuonCollection->setBXRange(firstBX, lastBX);
71-
regionalMuonShowerCollection->setBXRange(firstBX, lastBX);
72-
67+
if (regionalMuonShowerCollection) {
68+
regionalMuonShowerCollection->setBXRange(firstBX, lastBX);
69+
}
7370
LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
7471

7572
// Get the BX blocks and unpack them
@@ -127,7 +124,8 @@ namespace l1t {
127124
// Fill RegionalMuonShower objects. For this we need to look at all six words together.
128125
RegionalMuonShower muShower;
129126
if (RegionalMuonRawDigiTranslator::fillRegionalMuonShower(
130-
muShower, bxPayload, processor, trackFinder, useEmtfNominalTightShowers_, useEmtfLooseShowers_)) {
127+
muShower, bxPayload, processor, trackFinder, useEmtfNominalTightShowers_, useEmtfLooseShowers_) and
128+
regionalMuonShowerCollection) {
131129
regionalMuonShowerCollection->push_back(bx, muShower);
132130
}
133131
} else {

0 commit comments

Comments
 (0)