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/libehp b/libehp index cda036f54b68d2eb1bfd0c0d636dad954433a3b7..30ad94f8eb2f18f7c5d9ca61a05d55213100bdc8 160000 --- a/libehp +++ b/libehp @@ -1 +1 @@ -Subproject commit cda036f54b68d2eb1bfd0c0d636dad954433a3b7 +Subproject commit 30ad94f8eb2f18f7c5d9ca61a05d55213100bdc8 diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp index e7b0506a9bf1a6b0f4810039dffbefd53ca29afa..5164428febfb4a2b62e20b098b45a025f9db9eda 100644 --- a/src/base/SMPFunction.cpp +++ b/src/base/SMPFunction.cpp @@ -391,6 +391,38 @@ 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]; + } + +#if 0 // crashes in STARS/IRDB ??? + 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; + } + } +#endif + + 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..ac33c3f8eec11d28bb4922079013a14125457f9a 100644 --- a/src/base/SMPInstr.cpp +++ b/src/base/SMPInstr.cpp @@ -4931,8 +4931,8 @@ SMPInstr::~SMPInstr() { this->Defs.clear(); this->Uses.clear(); } -#if 0 // fix crashes before enabling this - if (nullptr != this->STARSInstPtr) { +#if 1 // fix crashes before enabling this + if (global_STARS_program->IsIDAProDriverMode() && (nullptr != this->STARSInstPtr)) { delete this->STARSInstPtr; this->STARSInstPtr = nullptr; }