Hi all,

the patch fixes memory leak evolved by the alpha.cplusplus.NewDeleteLeaks checker ran over the LLVM codebase.
OK to commit?

--
Anton

Index: CompilerInstance.cpp
===================================================================
--- CompilerInstance.cpp	(revision 217620)
+++ CompilerInstance.cpp	(working copy)
@@ -139,9 +139,9 @@
   raw_ostream *OS = &llvm::errs();
   if (DiagOpts->DiagnosticLogFile != "-") {
     // Create the output stream.
-    llvm::raw_fd_ostream *FileOS(new llvm::raw_fd_ostream(
+    auto FileOS = llvm::make_unique<llvm::raw_fd_ostream>(
         DiagOpts->DiagnosticLogFile, EC,
-        llvm::sys::fs::F_Append | llvm::sys::fs::F_Text));
+        llvm::sys::fs::F_Append | llvm::sys::fs::F_Text);
     if (EC) {
       Diags.Report(diag::warn_fe_cc_log_diagnostics_failure)
           << DiagOpts->DiagnosticLogFile << EC.message();
@@ -148,7 +148,7 @@
     } else {
       FileOS->SetUnbuffered();
       FileOS->SetUseAtomicWrites(true);
-      OS = FileOS;
+      OS = FileOS.release();
       OwnsStream = true;
     }
   }
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to