[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
Wed Feb 22 00:48:37 PST 2017


xiangzhai updated this revision to Diff 89331.
xiangzhai added a comment.

Hi Anna,

I added **svalBinMulOp**  to take BO_Mul evalBinOp for g_malloc_n's two arguments: CE->getArg(0) and CE->getArg(1), so it does **NOT** need to change **MallocMemAux** any more, but just use it in this way:

  State = MallocMemAux(C, CE,                                               
                                           svalBinMulOp(C, CE->getArg(0), CE->getArg(1), State),
                                           UndefinedVal(), State);

And I also added **ReallocMemN** for g_realloc_n, it also use svalBinMulOp for **!StateSizeIsZero** check.

Please indicate my mistake, thanks a lot!

Regards,
Leslie Zhai


Repository:
  rL LLVM

https://reviews.llvm.org/D28348

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/gmalloc.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28348.89331.patch
Type: text/x-patch
Size: 19279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170222/a531eb68/attachment-0001.bin>


More information about the cfe-commits mailing list