[cfe-commits] r137523 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp test/Analysis/keychainAPI.m
Jordy Rose
jediknil at belkadan.com
Fri Aug 12 16:10:24 PDT 2011
On Aug 12, 2011, at 14:56, Anna Zaks wrote:
> +RangedBugReport *MacOSKeychainAPIChecker::
> + generateAllocatedDataNotReleasedReport(const AllocationState &AS,
> + ExplodedNode *N) const {
> + const ADFunctionInfo &FI = FunctionsToTrack[AS.AllocatorIdx];
> + initBugType();
> + std::string sbuf;
> + llvm::raw_string_ostream os(sbuf);
> + os << "Allocated data is not released: missing a call to '"
> + << FunctionsToTrack[FI.DeallocatorIdx].Name << "'.";
> + RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N);
> + Report->addRange(AS.Address->getSourceRange());
> + return Report;
> +}
Since this string is fairly short and roughly of constant length, it might be better to use an llvm::SmallString to allocate the memory on the stack.
More information about the cfe-commits
mailing list