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