[clang-tools-extra] r295198 - [clangd] Fix another use after free that I missed because COW strings.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 09:04:57 PST 2017


Author: d0k
Date: Wed Feb 15 11:04:57 2017
New Revision: 295198

URL: http://llvm.org/viewvc/llvm-project?rev=295198&view=rev
Log:
[clangd] Fix another use after free that I missed because COW strings.

Modified:
    clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp

Modified: clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp?rev=295198&r1=295197&r2=295198&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp (original)
+++ clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp Wed Feb 15 11:04:57 2017
@@ -113,7 +113,7 @@ void TextDocumentFormattingHandler::hand
   }
 
   // Format everything.
-  StringRef Code = Store.getDocument(DFP->textDocument.uri);
+  std::string Code = Store.getDocument(DFP->textDocument.uri);
   writeMessage(formatCode(Code, DFP->textDocument.uri,
                           {clang::tooling::Range(0, Code.size())}, ID));
 }




More information about the cfe-commits mailing list