[PATCH] D90599: Fix a leak in `ASTUnit::LoadFromCommandLine()` wehn compiler invocation fails

Boris Staletic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 7 01:10:31 PST 2020


bstaletic updated this revision to Diff 303624.
bstaletic added a comment.

Fixed the code formatting error.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90599/new/

https://reviews.llvm.org/D90599

Files:
  clang/lib/Frontend/ASTUnit.cpp


Index: clang/lib/Frontend/ASTUnit.cpp
===================================================================
--- clang/lib/Frontend/ASTUnit.cpp
+++ clang/lib/Frontend/ASTUnit.cpp
@@ -1757,8 +1757,11 @@
 
     CI = createInvocationFromCommandLine(
         llvm::makeArrayRef(ArgBegin, ArgEnd), Diags, VFS);
-    if (!CI)
+    if (!CI) {
+      for (const auto &RF : RemappedFiles)
+        delete RF.second;
       return nullptr;
+    }
   }
 
   // Override any files that need remapping


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90599.303624.patch
Type: text/x-patch
Size: 487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201107/3ab4982a/attachment-0001.bin>


More information about the cfe-commits mailing list