]> granicus.if.org Git - clang/commit
[analyzer] Fix false positives in Keychain API checker
authorAnna Zaks <ganna@apple.com>
Fri, 13 Jan 2017 00:50:41 +0000 (00:50 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 13 Jan 2017 00:50:41 +0000 (00:50 +0000)
commit434e02b58246b87259c1e58b1430a0517522a2f8
tree21df9d6136dbf4ede6d4207a90a7a9267bbb79a2
parent4a7f5b5806b850e6655ef6e586b76307297eed57
[analyzer] Fix false positives in Keychain API checker

The checker has several false positives that this patch addresses:
- Do not check if the return status has been compared to error (or no error) at the time when leaks are reported since the status symbol might no longer be alive. Instead, pattern match on the assume and stop tracking allocated symbols on error paths.
- The checker used to report error when an unknown symbol was freed. This could lead to false positives, let's not repot those. This leads to loss of coverage in double frees.
- Do not enforce that we should only call free if we are sure that error was not returned and the pointer is not null. That warning is too noisy and we received several false positive reports about it. (I removed: "Only call free if a valid (non-NULL) buffer was returned")
- Use !isDead instead of isLive in leak reporting. Otherwise, we report leaks for objects we loose track of. This change triggered change #1.

This also adds checker specific dump to the state.

Differential Revision: https://reviews.llvm.org/D28330

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291866 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
test/Analysis/keychainAPI.m