about summary refs log tree commit diff homepage
path: root/lib/Core/Executor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Core/Executor.cpp')
-rw-r--r--lib/Core/Executor.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 0b28d608..5194aff2 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -494,7 +494,7 @@ Executor::Executor(LLVMContext &ctx, const InterpreterOptions &opts,
       interpreterHandler->getOutputFilename(SOLVER_QUERIES_KQUERY_FILE_NAME));
 
   this->solver = std::make_unique<TimingSolver>(std::move(solver), EqualitySubstitution);
-  memory = new MemoryManager(&arrayCache);
+  memory = std::make_unique<MemoryManager>(&arrayCache);
 
   initializeSearchOptions();
 
@@ -589,7 +589,6 @@ Executor::setModule(std::vector<std::unique_ptr<llvm::Module>> &modules,
 }
 
 Executor::~Executor() {
-  delete memory;
   delete externalDispatcher;
   delete specialFunctionHandler;
   delete statsTracker;
@@ -4548,7 +4547,8 @@ void Executor::runFunctionAsMain(Function *f,
     }
   }
 
-  ExecutionState *state = new ExecutionState(kmodule->functionMap[f], memory);
+  ExecutionState *state =
+      new ExecutionState(kmodule->functionMap[f], memory.get());
 
   if (pathWriter) 
     state->pathOS = pathWriter->open();
@@ -4597,8 +4597,7 @@ void Executor::runFunctionAsMain(Function *f,
   processTree = nullptr;
 
   // hack to clear memory objects
-  delete memory;
-  memory = new MemoryManager(NULL);
+  memory = nullptr;
 
   globalObjects.clear();
   globalAddresses.clear();