Skip to content
Snippets Groups Projects
Commit 54cd8f87 authored by Clark Coleman's avatar Clark Coleman
Browse files

Fix some memory leaks.

parent 661cc55f
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,12 @@ public:
// Constructors
STARS_IDA_Interface_t() : CGCBinary(false) {};
// Destructor
~STARS_IDA_Interface_t() {
this->funcmap.clear();
this->segmap.clear();
}
// Segment accessors
virtual STARS_Segment_t *getseg(const STARS_ea_t &addr) {
......
......@@ -391,6 +391,36 @@ SMPFunction::~SMPFunction() {
// when we saved the exprs for SPARK Ada translation.
this->DestroyLoopExprs();
}
for (size_t i = 0; i < this->ShadowCFGBlocks.size(); ++i) {
if (nullptr != this->ShadowCFGBlocks[i])
delete this->ShadowCFGBlocks[i];
}
for (size_t i = 0; i < this->LoopInductionVars.size(); ++i) {
for (struct InductionVarFamily CurrFam : this->LoopInductionVars[i]) {
if (nullptr != CurrFam.BIVInitExpr)
delete CurrFam.BIVInitExpr;
if (nullptr != CurrFam.BIVLimitExpr)
delete CurrFam.BIVLimitExpr;
}
}
for (size_t i = 0; i < this->LoopMemAddrExprsFromCalleeLoops.size(); ++i) {
for (STARSExpression *CurrExpr : this->LoopMemAddrExprsFromCalleeLoops[i]) {
if (nullptr != CurrExpr)
delete CurrExpr;
}
}
for (size_t i = 0; i < this->LoopMemAddrExprsFromCallees.size(); ++i) {
for (STARSExpression *CurrExpr : this->LoopMemAddrExprsFromCallees[i]) {
if (nullptr != CurrExpr)
delete CurrExpr;
}
}
return;
} // end of SMPFunction::destructor
 
void SMPFunction::DestroyLoopExprs(void) {
......
......@@ -4931,7 +4931,7 @@ SMPInstr::~SMPInstr() {
this->Defs.clear();
this->Uses.clear();
}
#if 0 // fix crashes before enabling this
#if 1 // fix crashes before enabling this
if (nullptr != this->STARSInstPtr) {
delete this->STARSInstPtr;
this->STARSInstPtr = nullptr;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment