[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
Fri Feb 24 22:23:39 PST 2017
zaks.anna added a comment.
> Firstly I uploaded Glib-MallocChecker-single-size-value.patch for code review, if submitted to UPSTREAM, then upload another one, correct?
Yes. By the way, you can model XXX_n variants similarly to how calloc is modeled (see CallocMem).
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:785
- if (FunI == II_malloc) {
+ if (FunI == II_malloc || FunI == II_g_malloc || FunI == II_g_malloc0 ||
+ FunI == II_g_try_malloc || FunI == II_g_try_malloc0) {
----------------
g_malloc0 needs to be initialized with zeros, not UndefinedVal(). See the relevant part in MallocChecker::CallocMem:
SVal zeroVal = svalBuilder.makeZeroVal(svalBuilder.getContext().CharTy);
return MallocMemAux(C, CE, TotalSize, zeroVal, State);
Repository:
rL LLVM
https://reviews.llvm.org/D28348
More information about the cfe-commits
mailing list