iphone - LLVM/Clang bug found in convenience method and NSClassFromString(...) alloc/release -


I am analyzing the objective-iPhone project with the LLVM / Clang static analyzer. I'm getting two reported bugs, but I'm pretty sure the code is correct.

1) Feature method.

  + (UILabel *) simpleLabel {UILabel * label = [[UILabel alloc] initWithFrame: CGRectMake (100, 10, 200, 25)]; Label.adjustsFontSizeToFitWidth = Yes; [Label autorelage]; Returns the number of the caller to maintain the object +0 with the // object, where a +1 (owner) is expected to maintain. return label; }  

2) [NSClassFromString (...) alloc gives retainCount + 1. I am right?

  class details ViewControllerClass = NSClassFromString (auto.visionViewControllerName); UIViewController * detailsViewController = [[detailsViewControllerClass alloc] Display: Selector (initWithAdditive :) withObject: additive]; [Self. Parent Controller Navigation Push ViewController: Animated Details Viewfinder: Yes]; [Details viewer release]; // Do not have an abnormal ownership of an object's reference count ...  

Is it some clag issues or am I completely wrong in both of these cases?

Your code looks correct in both cases, for 2, you might simply see initWithAdditive < Analysts are confusing by using showSelector instead of / code> (is there any special reason that you are using the selector?). I'm not sure about No 1, but maybe try to start with [[[UILabel alloc] init ...] Automatize instead of auto-release and see that Does the problem persist?


Comments