[PATCH] D28348: [analyzer] Taught the analyzer about Glib API to check Memory-leak
Anna Zaks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 16:15:15 PST 2017
zaks.anna added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:810
+ if (CE->getNumArgs() == 2)
+ State = ProcessZeroAllocation(C, CE, 1, State);
} else if (CE->getNumArgs() == 3) {
----------------
Why did you remove the old behavior here and below?
I would expect this patch to be strictly additive. If gmalloc APIs take a different number of arguments, please, process them separately. You might need to factor out the processing code to avoid code duplication.
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:838
State = ProcessZeroAllocation(C, CE, 1, State);
+ if (CE->getNumArgs() > 2)
+ State = ProcessZeroAllocation(C, CE, 2, State);
----------------
Should this be conditional on the number of arguments instead of adding two calls to ProcessZeroAllocation?
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:846
State = ProcessZeroAllocation(C, CE, 0, State);
- State = ProcessZeroAllocation(C, CE, 1, State);
- } else if (FunI == II_free) {
+ } else if (FunI == II_free || FunI == II_g_free) {
State = FreeMemAux(C, CE, State, 0, false, ReleasedAllocatedMemory);
----------------
This change in how calloc is handled broke the Analysis/malloc.c test.
Repository:
rL LLVM
https://reviews.llvm.org/D28348
More information about the cfe-commits
mailing list