From 4eaf89f2d9b268d7fcc17aca808acf8ede434b08 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 15 Feb 2017 15:56:14 +0000 Subject: [PATCH] [clangd] Fix use after free. llvm-svn: 295187 --- clang-tools-extra/clangd/ProtocolHandlers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/ProtocolHandlers.cpp b/clang-tools-extra/clangd/ProtocolHandlers.cpp index 67a73fee910f..7d321a2f0253 100644 --- a/clang-tools-extra/clangd/ProtocolHandlers.cpp +++ b/clang-tools-extra/clangd/ProtocolHandlers.cpp @@ -95,7 +95,7 @@ void TextDocumentRangeFormattingHandler::handleMethod( return; } - StringRef Code = Store.getDocument(DRFP->textDocument.uri); + std::string Code = Store.getDocument(DRFP->textDocument.uri); size_t Begin = positionToOffset(Code, DRFP->range.start); size_t Len = positionToOffset(Code, DRFP->range.end) - Begin;