From: Devin Coughlin Date: Fri, 26 Feb 2016 00:23:41 +0000 (+0000) Subject: [analyzer] Fix a memory error in r261935 caught by the Windows bots. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a325236d5d6232fda5902d58946397d404d5aa89;p=clang [analyzer] Fix a memory error in r261935 caught by the Windows bots. It was using a temporary StringRef after its underlying storage was freed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261944 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp index 596ad70c42..263da20146 100644 --- a/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp @@ -162,9 +162,9 @@ void ObjCSuperDeallocChecker::checkLocation(SVal L, bool IsLoad, const Stmt *S, StringRef Desc = StringRef(); auto *IvarRegion = dyn_cast_or_null(PriorSubRegion); + std::string Buf; + llvm::raw_string_ostream OS(Buf); if (IvarRegion) { - std::string Buf; - llvm::raw_string_ostream OS(Buf); OS << "use of instance variable '" << *IvarRegion->getDecl() << "' after the instance has been freed with call to [super dealloc]"; Desc = OS.str();