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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to