summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
diff options
context:
space:
mode:
authorReka Kovacs <rekanikolett@gmail.com>2018-07-19 15:44:46 +0000
committerReka Kovacs <rekanikolett@gmail.com>2018-07-19 15:44:46 +0000
commit52dd98bd1e7eb0706005e13497379b9412ec061e (patch)
tree4d83b7441c3a455c1b7746c9bd510aacf118bbed /clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
parent293b0f43acf5cd8f22cd531e05966acc2e910669 (diff)
downloadbcm5719-llvm-52dd98bd1e7eb0706005e13497379b9412ec061e.tar.gz
bcm5719-llvm-52dd98bd1e7eb0706005e13497379b9412ec061e.zip
[analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests
Correct a mistake of the exact same kind I am writing this checker for. llvm-svn: 337466
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 9049fa324be..5dcd9b3863a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2901,6 +2901,9 @@ std::shared_ptr<PathDiagnosticPiece> MallocChecker::MallocBugVisitor::VisitNode(
// Find out if this is an interesting point and what is the kind.
const char *Msg = nullptr;
StackHintGeneratorForSymbol *StackHint = nullptr;
+ SmallString<256> Buf;
+ llvm::raw_svector_ostream OS(Buf);
+
if (Mode == Normal) {
if (isAllocated(RS, RSPrev, S)) {
Msg = "Memory is allocated";
@@ -2917,8 +2920,6 @@ std::shared_ptr<PathDiagnosticPiece> MallocChecker::MallocBugVisitor::VisitNode(
Msg = "Memory is released";
break;
case AF_InternalBuffer: {
- SmallString<256> Buf;
- llvm::raw_svector_ostream OS(Buf);
OS << "Inner pointer invalidated by call to ";
if (N->getLocation().getKind() == ProgramPoint::PostImplicitCallKind) {
OS << "destructor";
OpenPOWER on IntegriCloud