From: Daniel Jasper Date: Thu, 5 Mar 2015 23:17:32 +0000 (+0000) Subject: Use std::string instead of StringRef to prevent use-after-free. X-Git-Tag: llvmorg-3.7.0-rc1~10016 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08201e394e62575a5b551b707d64ee9576ba89b7;p=platform%2Fupstream%2Fllvm.git Use std::string instead of StringRef to prevent use-after-free. Discovered by asan. llvm-svn: 231421 --- diff --git a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp index 61c7b36..7264f49 100644 --- a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp @@ -83,7 +83,7 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) { bool NeedLineBreak = NextTokenIsOnSameLine && Tok.isNot(tok::eof); SourceRange OldCommentRange(AfterRBrace, AfterRBrace); - StringRef Message = "%0 not terminated with a closing comment"; + std::string Message = "%0 not terminated with a closing comment"; // Try to find existing namespace closing comment on the same line. if (Tok.is(tok::comment) && NextTokenIsOnSameLine) {