[llvm] r187301 - Fix a memory leak in the debug emission by simply not allocating memory.
Chandler Carruth
chandlerc at gmail.com
Sat Jul 27 04:09:59 PDT 2013
Author: chandlerc
Date: Sat Jul 27 06:09:58 2013
New Revision: 187301
URL: http://llvm.org/viewvc/llvm-project?rev=187301&view=rev
Log:
Fix a memory leak in the debug emission by simply not allocating memory.
There doesn't appear to be any reason to put this variable on the heap.
I'm suspicious of the LexicalScope above that we stuff in a map and then
delete afterward, but I'm just trying to get the valgrind bot clean.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=187301&r1=187300&r2=187301&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sat Jul 27 06:09:58 2013
@@ -951,9 +951,9 @@ void DwarfDebug::collectDeadVariables()
for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {
DIVariable DV(Variables.getElement(vi));
if (!DV.isVariable()) continue;
- DbgVariable *NewVar = new DbgVariable(DV, NULL);
+ DbgVariable NewVar(DV, NULL);
if (DIE *VariableDIE =
- SPCU->constructVariableDIE(NewVar, Scope->isAbstractScope()))
+ SPCU->constructVariableDIE(&NewVar, Scope->isAbstractScope()))
ScopeDIE->addChild(VariableDIE);
}
}
More information about the llvm-commits
mailing list