Plug memory leaks in AsmWriterEmitter::EmitPrintAliasInstruction.
authorYaron Keren <yaron.keren@gmail.com>
Thu, 6 Aug 2015 13:18:59 +0000 (13:18 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Thu, 6 Aug 2015 13:18:59 +0000 (13:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244212 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmWriterEmitter.cpp

index 8163f681d88da644d4a48073912f5f5138fa9534..7e52e978fb53b3cb0d7a9c6d29e6b6662e1f0a3e 100644 (file)
@@ -1099,6 +1099,14 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
   }
 
   O << "#endif // PRINT_ALIAS_INSTR\n";
+
+  // Free allocated memory.
+  for (auto &Aliases : AliasMap)
+    for (auto &Alias : Aliases.second)
+      delete Alias.first;
+  for (auto &P : IAPrinterMap)
+    for (IAPrinter* IAP : P.second)
+      delete IAP;  
 }
 
 AsmWriterEmitter::AsmWriterEmitter(RecordKeeper &R) : Records(R), Target(R) {