r261944 - [analyzer] Fix a memory error in r261935 caught by the Windows bots.
Devin Coughlin via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 25 16:23:42 PST 2016
Author: dcoughlin
Date: Thu Feb 25 18:23:41 2016
New Revision: 261944
URL: http://llvm.org/viewvc/llvm-project?rev=261944&view=rev
Log:
[analyzer] Fix a memory error in r261935 caught by the Windows bots.
It was using a temporary StringRef after its underlying storage was freed.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp?rev=261944&r1=261943&r2=261944&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp Thu Feb 25 18:23:41 2016
@@ -162,9 +162,9 @@ void ObjCSuperDeallocChecker::checkLocat
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();
More information about the cfe-commits
mailing list