summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-03-16 05:54:54 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-03-16 05:54:54 +0000
commit7d83d9b23c8b20471c9b91e590cc3cd5270f6be9 (patch)
treea351ad3c3819a333fed8dbc6b282b117d54d301d
parentf857e0bbe7dfedfef956f1d9796831ec886ae300 (diff)
downloadbcm5719-llvm-7d83d9b23c8b20471c9b91e590cc3cd5270f6be9.tar.gz
bcm5719-llvm-7d83d9b23c8b20471c9b91e590cc3cd5270f6be9.zip
Avoid a memory leak in JITDebugRegisterer.
llvm-svn: 98612
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp b/llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp
index 565509cd1f3..68471bd4d5f 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp
@@ -165,7 +165,7 @@ void JITDebugRegisterer::RegisterFunction(const Function *F, DebugInfo &I) {
void JITDebugRegisterer::UnregisterFunctionInternal(
RegisteredFunctionsMap::iterator I) {
- jit_code_entry *JITCodeEntry = I->second.second;
+ jit_code_entry *&JITCodeEntry = I->second.second;
// Acquire the lock and do the unregistration.
{
@@ -190,6 +190,9 @@ void JITDebugRegisterer::UnregisterFunctionInternal(
__jit_debug_register_code();
}
+ delete JITCodeEntry;
+ JITCodeEntry = NULL;
+
// Free the ELF file in memory.
std::string &Buffer = I->second.first;
Buffer.clear();
OpenPOWER on IntegriCloud