[PATCH] [analyzer] Detect use-after-free scenarios in -dealloc after calling [super dealloc]

David Kilzer ddkilzer at kilzer.net
Sun Sep 7 20:19:20 PDT 2014


I started a path-sensitive checker in D5238 for [super dealloc] calls.  Once that lands, I can re-implement these checks using that checker.

I implemented the "duplicate [super dealloc]" check since that seemed the most logical (and simpler) to start with.

Thanks for the tip about the video, Anna!  That was a big help.

================
Comment at: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp:74-78
@@ +73,7 @@
+
+  // Recurse to children.
+  for (Stmt::child_iterator I = S->child_begin(), E = S->child_end(); I != E;
+       ++I)
+    if (*I && scan_dealloc_for_self_after_super_dealloc(*I, Callback, Ctx))
+      return true;
+
----------------
And I just realized this code is unnecessary when using the ASTMatcher.  Will upload another patch later today.

http://reviews.llvm.org/D5042






More information about the cfe-commits mailing list