diff options
author | Reka Kovacs <rekanikolett@gmail.com> | 2018-07-07 19:27:18 +0000 |
---|---|---|
committer | Reka Kovacs <rekanikolett@gmail.com> | 2018-07-07 19:27:18 +0000 |
commit | e453e60d081a81d83bfe0f4631e1a5c0e2902286 (patch) | |
tree | f8fb28203025a598ea2434cc814568cc6cbb57c7 /clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | |
parent | f90680949690d724257b758942cb608f63f4e73c (diff) | |
download | bcm5719-llvm-e453e60d081a81d83bfe0f4631e1a5c0e2902286.tar.gz bcm5719-llvm-e453e60d081a81d83bfe0f4631e1a5c0e2902286.zip |
[analyzer] Highlight c_str() call in DanglingInternalBufferChecker.
Add a bug visitor to DanglingInternalBufferChecker that places a note
at the point where the dangling pointer was obtained. The visitor is
handed over to MallocChecker and attached to the report there.
Differential Revision: https://reviews.llvm.org/D48522
llvm-svn: 336495
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index fa50014b07a..fd2699320d2 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -1993,6 +1993,11 @@ void MallocChecker::ReportUseAfterFree(CheckerContext &C, SourceRange Range, R->markInteresting(Sym); R->addRange(Range); R->addVisitor(llvm::make_unique<MallocBugVisitor>(Sym)); + + const RefState *RS = C.getState()->get<RegionState>(Sym); + if (RS->getAllocationFamily() == AF_InternalBuffer) + R->addVisitor(allocation_state::getDanglingBufferBRVisitor(Sym)); + C.emitReport(std::move(R)); } } |