diff --git a/include/interfaces/idapro/STARSInterface.h b/include/interfaces/idapro/STARSInterface.h index a8d8df2d415125ce15285b9133fc40b2bbefb842..80000d24846a14d4426d27348ed37ecbc8e89db4 100644 --- a/include/interfaces/idapro/STARSInterface.h +++ b/include/interfaces/idapro/STARSInterface.h @@ -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) { diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp index e7b0506a9bf1a6b0f4810039dffbefd53ca29afa..53a8e59b892b10d29d689d801ab451bc389a3b47 100644 --- a/src/base/SMPFunction.cpp +++ b/src/base/SMPFunction.cpp @@ -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) { diff --git a/src/base/SMPInstr.cpp b/src/base/SMPInstr.cpp index af1b6e2bef249a46a11b3e57394bce86e028b8dc..61fb134a882f1604fc35d73ad2e768658680949b 100644 --- a/src/base/SMPInstr.cpp +++ b/src/base/SMPInstr.cpp @@ -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;