Avoid a memory leak in JITDebugRegisterer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeffrey Yasskin 2010-03-16 05:54:54 +00:00
parent 7cfb6d373a
commit 6efed73eb5

View File

@ -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();