[PATCH] D28348: [analyzer] Taught the analyzer about Glib API to check Memory-leak
Leslie Zhai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 19 20:28:44 PST 2017
xiangzhai added a comment.
Hi Anna,
I am not clear why need to calculate the precise allocated size? for example:
void *ptr = malloc(size);
void *gptr = g_malloc_n(n_blocks, n_block_bytes);
Memory-leak and Use-after-free issues' MallocChecker need the ***size*** or ***n_blocks*** x ***n_block_bytes***, but if the size is inaccurate, the checker is also ***able*** to detect the issues.
Regards,
Leslie Zhai
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:889
+ } else if (FunI == II_g_realloc_n || FunI == II_g_try_realloc_n) {
+ if (CE->getNumArgs() < 2)
+ return;
----------------
zaks.anna wrote:
> Should this be 'getNumArgs() < 3' ?
sorry typo...
Repository:
rL LLVM
https://reviews.llvm.org/D28348
More information about the cfe-commits
mailing list