diff options
author | Cristian Cadar <c.cadar@imperial.ac.uk> | 2013-12-05 09:15:53 -0800 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2013-12-05 09:15:53 -0800 |
commit | 6d19d31eed55e18709c95363beafe8f679d6070c (patch) | |
tree | 945280a95c48b1e89061d6fd303beed1c5692257 /lib | |
parent | 7c415a118f1bfc291cc6f2479b78db8041db95a4 (diff) | |
parent | 29c87addb0bf80baafc5f561cb68509a70a5b1c5 (diff) | |
download | klee-6d19d31eed55e18709c95363beafe8f679d6070c.tar.gz |
Merge pull request #11 from MartinNowack/Memleaks
Patch Set II - Memleaks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Core/Executor.cpp | 5 | ||||
-rw-r--r-- | lib/Core/ExecutorTimerInfo.h | 42 | ||||
-rw-r--r-- | lib/Core/ExecutorTimers.cpp | 20 | ||||
-rw-r--r-- | lib/Module/KModule.cpp | 4 | ||||
-rw-r--r-- | lib/Module/Passes.h | 2 |
5 files changed, 54 insertions, 19 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 6df8dd14..eadc685b 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -24,6 +24,7 @@ #include "StatsTracker.h" #include "TimingSolver.h" #include "UserSearcher.h" +#include "ExecutorTimerInfo.h" #include "../Solver/SolverStats.h" #include "klee/ExecutionState.h" @@ -385,6 +386,10 @@ Executor::~Executor() { delete statsTracker; delete solver; delete kmodule; + while(!timers.empty()) { + delete timers.back(); + timers.pop_back(); + } } /***/ diff --git a/lib/Core/ExecutorTimerInfo.h b/lib/Core/ExecutorTimerInfo.h new file mode 100644 index 00000000..60977b74 --- /dev/null +++ b/lib/Core/ExecutorTimerInfo.h @@ -0,0 +1,42 @@ +//===-- Executor.h ----------------------------------------------*- C++ -*-===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Class to wrap information for a timer. +// +//===----------------------------------------------------------------------===// + +#ifndef EXECUTORTIMERINFO_H_ +#define EXECUTORTIMERINFO_H_ + +#include "klee/Internal/System/Time.h" + +namespace klee { + +class Executor::TimerInfo { +public: + Timer *timer; + + /// Approximate delay per timer firing. + double rate; + /// Wall time for next firing. + double nextFireTime; + +public: + TimerInfo(Timer *_timer, double _rate) + : timer(_timer), + rate(_rate), + nextFireTime(util::getWallTime() + rate) {} + ~TimerInfo() { delete timer; } +}; + + +} + + +#endif /* EXECUTORTIMERINFO_H_ */ diff --git a/lib/Core/ExecutorTimers.cpp b/lib/Core/ExecutorTimers.cpp index 6a5314ca..06fd4be7 100644 --- a/lib/Core/ExecutorTimers.cpp +++ b/lib/Core/ExecutorTimers.cpp @@ -13,6 +13,7 @@ #include "Executor.h" #include "PTree.h" #include "StatsTracker.h" +#include "ExecutorTimerInfo.h" #include "klee/ExecutionState.h" #include "klee/Internal/Module/InstructionInfoTable.h" @@ -93,7 +94,7 @@ void Executor::initTimers() { } if (MaxTime) { - addTimer(new HaltTimer(this), MaxTime); + addTimer(new HaltTimer(this), MaxTime.getValue()); } } @@ -103,23 +104,6 @@ Executor::Timer::Timer() {} Executor::Timer::~Timer() {} -class Executor::TimerInfo { -public: - Timer *timer; - - /// Approximate delay per timer firing. - double rate; - /// Wall time for next firing. - double nextFireTime; - -public: - TimerInfo(Timer *_timer, double _rate) - : timer(_timer), - rate(_rate), - nextFireTime(util::getWallTime() + rate) {} - ~TimerInfo() { delete timer; } -}; - void Executor::addTimer(Timer *timer, double rate) { timers.push_back(new TimerInfo(timer, rate)); } diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index ff13efda..7b23a9c9 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -127,6 +127,10 @@ KModule::~KModule() { ie = functions.end(); it != ie; ++it) delete *it; + for (std::map<llvm::Constant*, KConstant*>::iterator it=constantMap.begin(), + itE=constantMap.end(); it!=itE;++it) + delete it->second; + delete targetData; delete module; } diff --git a/lib/Module/Passes.h b/lib/Module/Passes.h index 0c294daa..c6e09f0f 100644 --- a/lib/Module/Passes.h +++ b/lib/Module/Passes.h @@ -64,7 +64,7 @@ public: #if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) RaiseAsmPass() : llvm::ModulePass((intptr_t) &ID) {} #else - RaiseAsmPass() : llvm::ModulePass(ID) {} + RaiseAsmPass() : llvm::ModulePass(ID), TLI(0) {} #endif virtual bool runOnModule(llvm::Module &M); |