Skip to content

Commit

Permalink
[ARM][MachineOutliner] Fix memory leak rust-lang#2.
Browse files Browse the repository at this point in the history
Use smart pointer instead of new/delete.
  • Loading branch information
yroux committed May 15, 2020
1 parent 6894d95 commit 3648dde
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5649,7 +5649,7 @@ outliner::OutlinedFunction ARMBaseInstrInfo::getOutliningCandidateInfo(
C.setCallInfo(CallID, NumBytesForCall);
};

OutlinerCosts *Costs = new OutlinerCosts(Subtarget);
auto Costs = std::make_unique<OutlinerCosts>(Subtarget);
unsigned FrameID = 0;
unsigned NumBytesToCreateFrame = 0;

Expand All @@ -5668,7 +5668,6 @@ outliner::OutlinedFunction ARMBaseInstrInfo::getOutliningCandidateInfo(
} else
return outliner::OutlinedFunction();

delete Costs;
return outliner::OutlinedFunction(RepeatedSequenceLocs, SequenceSize,
NumBytesToCreateFrame, FrameID);
}
Expand Down

0 comments on commit 3648dde

Please sign in to comment.