summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 11abe9a41b7..bb2e2df2acf 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -1890,6 +1890,12 @@ bool MallocChecker::doesNotFreeMemOrInteresting(const CallEvent *Call,
return false;
}
+ // We should escape on call to 'init'. This is especially relevant to the
+ // receiver, as the corresponding symbol is usually not referenced after
+ // the call.
+ if (Msg->getMethodFamily() == OMF_init)
+ return false;
+
// Otherwise, assume that the method does not free memory.
// Most framework methods do not free memory.
return true;
OpenPOWER on IntegriCloud