Avoid a memory leak in JITDebugRegisterer.

llvm-svn: 98612
This commit is contained in:
Jeffrey Yasskin 2010-03-16 05:54:54 +00:00
parent f857e0bbe7
commit 7d83d9b23c
1 changed files with 4 additions and 1 deletions

View File

@ -165,7 +165,7 @@ void JITDebugRegisterer::RegisterFunction(const Function *F, DebugInfo &I) {
void JITDebugRegisterer::UnregisterFunctionInternal( void JITDebugRegisterer::UnregisterFunctionInternal(
RegisteredFunctionsMap::iterator I) { RegisteredFunctionsMap::iterator I) {
jit_code_entry *JITCodeEntry = I->second.second; jit_code_entry *&JITCodeEntry = I->second.second;
// Acquire the lock and do the unregistration. // Acquire the lock and do the unregistration.
{ {
@ -190,6 +190,9 @@ void JITDebugRegisterer::UnregisterFunctionInternal(
__jit_debug_register_code(); __jit_debug_register_code();
} }
delete JITCodeEntry;
JITCodeEntry = NULL;
// Free the ELF file in memory. // Free the ELF file in memory.
std::string &Buffer = I->second.first; std::string &Buffer = I->second.first;
Buffer.clear(); Buffer.clear();