Skip to content

Commit 4ac40da

Browse files
committed
[BOLT] Fix memory leak in StackClashAnalysis
1 parent 49d6fe2 commit 4ac40da

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

bolt/lib/Passes/StackClashAnalysis.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ class StackClashDFAnalysis
489489
friend Parent;
490490

491491
public:
492-
StackClashDFAnalysis(BinaryFunction &BF, MCPlusBuilder::AllocatorIdTy AllocId)
493-
: Parent(BF, AllocId), NumRegs(BF.getBinaryContext().MRI->getNumRegs()),
492+
StackClashDFAnalysis(BinaryFunction &BF)
493+
: Parent(BF, true), NumRegs(BF.getBinaryContext().MRI->getNumRegs()),
494494
BF(BF) {}
495495
virtual ~StackClashDFAnalysis() {}
496496

@@ -730,7 +730,7 @@ void StackClashAnalysis::runOnFunction(
730730
LLVM_DEBUG({ BF.dump(); });
731731

732732
if (BF.hasCFG()) {
733-
StackClashDFAnalysis SCDFA(BF, AllocatorId);
733+
StackClashDFAnalysis SCDFA(BF);
734734
SCDFA.run();
735735
BinaryContext &BC = BF.getBinaryContext();
736736

@@ -791,9 +791,6 @@ void StackClashAnalysis::runOnFunction(
791791
BC.MIB->addAnnotation(Inst, gadgetAnnotationIndex, MergedSCI);
792792
}
793793
}
794-
// FIXME: We need 2 allocatorIDs: 1 for the DFstate which we want to clear here.
795-
// Another for gadgetAnnotations which we must not free here.
796-
// BC.MIB->freeValuesAllocator(AllocatorId);
797794
}
798795
}
799796

0 commit comments

Comments
 (0)