Skip to content

Commit 3648dde

Browse files
committed
[ARM][MachineOutliner] Fix memory leak rust-lang#2.
Use smart pointer instead of new/delete.
1 parent 6894d95 commit 3648dde

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -5649,7 +5649,7 @@ outliner::OutlinedFunction ARMBaseInstrInfo::getOutliningCandidateInfo(
56495649
C.setCallInfo(CallID, NumBytesForCall);
56505650
};
56515651

5652-
OutlinerCosts *Costs = new OutlinerCosts(Subtarget);
5652+
auto Costs = std::make_unique<OutlinerCosts>(Subtarget);
56535653
unsigned FrameID = 0;
56545654
unsigned NumBytesToCreateFrame = 0;
56555655

@@ -5668,7 +5668,6 @@ outliner::OutlinedFunction ARMBaseInstrInfo::getOutliningCandidateInfo(
56685668
} else
56695669
return outliner::OutlinedFunction();
56705670

5671-
delete Costs;
56725671
return outliner::OutlinedFunction(RepeatedSequenceLocs, SequenceSize,
56735672
NumBytesToCreateFrame, FrameID);
56745673
}

0 commit comments

Comments
 (0)