[llvm-commits] [llvm] r98612 - /llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp

Jeffrey Yasskin jyasskin at google.com
Mon Mar 15 22:54:54 PDT 2010


Author: jyasskin
Date: Tue Mar 16 00:54:54 2010
New Revision: 98612

URL: http://llvm.org/viewvc/llvm-project?rev=98612&view=rev
Log:
Avoid a memory leak in JITDebugRegisterer.

Modified:
    llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp?rev=98612&r1=98611&r2=98612&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp Tue Mar 16 00:54:54 2010
@@ -165,7 +165,7 @@
 
 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 @@
     __jit_debug_register_code();
   }
 
+  delete JITCodeEntry;
+  JITCodeEntry = NULL;
+
   // Free the ELF file in memory.
   std::string &Buffer = I->second.first;
   Buffer.clear();





More information about the llvm-commits mailing list