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)
llvm-svn: 244212

llvm/utils/TableGen/AsmWriterEmitter.cpp

index 8163f68..7e52e97 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) {