[PATCH] D11832: [Patch] [Analyzer] false positive: Potential leak connected with memcpy (PR 22954)

pierre gousseau via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 09:58:06 PDT 2015

pgousseau added inline comments.

Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:1098
@@ +1097,3 @@
+      if (!NumElements)
+        return;
+      QualType ElementTy = AT->getElementType();
zaks.anna wrote:
> What happens on early returns? Here and the one below. Are there tests for these cases?
Oops yes returning here is wrong, if we return here we skip the code conjuring the default value at line 1122.
I will change it to a goto conjure_default for !NumElements == true.
Also a value of 0 for ElemSize is ok so no need to return actually.
I will add a test for 0 sized elements' array and 0 elements array and update the patch.
What do you think ?
Thanks !

Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:2359
@@ -2314,1 +2358,3 @@
+    RegionAndSymbolInvalidationTraits ITraits;
+    W.AddToWorkList(*I, ITraits);
ayartsev wrote:
> Too much unnecessary passing around of RegionAndSymbolInvalidationTraits parameter. What about moving "RegionAndSymbolInvalidationTraits" member from "invalidateRegionsWorker" class to the base class "ClusterAnalysis"?
Makes sense, I will update the patch.
Thanks !


More information about the cfe-commits mailing list