summaryrefslogtreecommitdiff
path: root/backend/src/ir
diff options
context:
space:
mode:
authorPan Xiuli <xiuli.pan@intel.com>2016-05-05 14:42:15 +0800
committerYang Rong <rong.r.yang@intel.com>2016-05-18 15:08:17 +0800
commit3ffc02efaf185acb89aa53ee7ff801211ed3b478 (patch)
tree1154656ad4c51edcae1e11e72e4b5ee421889d53 /backend/src/ir
parent01a581e386c8f4f946318deb880a046f80a12bbf (diff)
Backend: Fix printfs mem leak
Should pass pointer of new printf_fmt into map for later delete. Signed-off-by: Pan Xiuli <xiuli.pan@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'backend/src/ir')
-rw-r--r--backend/src/ir/unit.cpp1
-rw-r--r--backend/src/ir/unit.hpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/backend/src/ir/unit.cpp b/backend/src/ir/unit.cpp
index 56042446..c9cb15e3 100644
--- a/backend/src/ir/unit.cpp
+++ b/backend/src/ir/unit.cpp
@@ -33,6 +33,7 @@ namespace ir {
}
Unit::~Unit(void) {
for (const auto &pair : functions) GBE_DELETE(pair.second);
+ for (const auto &pair : printfs) GBE_DELETE(pair.second);
delete profilingInfo;
}
Function *Unit::getFunction(const std::string &name) const {
diff --git a/backend/src/ir/unit.hpp b/backend/src/ir/unit.hpp
index 9b9e41fc..10a1af69 100644
--- a/backend/src/ir/unit.hpp
+++ b/backend/src/ir/unit.hpp
@@ -47,7 +47,7 @@ namespace ir {
public:
typedef map<std::string, Function*> FunctionSet;
/*! Moved from printf pass */
- map<llvm::CallInst*, PrintfSet::PrintfFmt> printfs;
+ map<llvm::CallInst*, PrintfSet::PrintfFmt*> printfs;
/*! Create an empty unit */
Unit(PointerSize pointerSize = POINTER_32_BITS);
/*! Release everything (*including* the function pointers) */