summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2016-02-26 00:23:41 +0000
committerDevin Coughlin <dcoughlin@apple.com>2016-02-26 00:23:41 +0000
commitea5415fabb3a714ba54514c0b7c37b3551788b33 (patch)
treebf76d7d397243a096b5a6a00c0ab6d8e5eb5a44c /clang/lib
parentbca6eb85a3054af6d66d366d9fb9c57803d2e40b (diff)
downloadbcm5719-llvm-ea5415fabb3a714ba54514c0b7c37b3551788b33.tar.gz
bcm5719-llvm-ea5415fabb3a714ba54514c0b7c37b3551788b33.zip
[analyzer] Fix a memory error in r261935 caught by the Windows bots.
It was using a temporary StringRef after its underlying storage was freed. llvm-svn: 261944
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
index 596ad70c423..263da201465 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
+++ b/clang/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<ObjCIvarRegion>(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();
OpenPOWER on IntegriCloud