title: Obj-C, Potential leak of an object allocated on line, UIBarButtonItem alloc
body: <p>I'm getting an analyser leak, however this is the same code i'm using elsewhere without a problem. I know I'm using alloc and therefore I have to release, but I am doing this in dealloc.</p>
  
  <p>What am I doing wrong ?</p>
  
  <p>Header file: </p>
  
  <pre><code>@interface myViewController : UIViewController &lt;UITableViewDataSource, 
                 UITableViewDelegate&gt; {
  
      UIBarButtonItem *addButton;
  }
  @property (nonatomic, retain) UIBarButtonItem *addButton;
  </code></pre>
  
  <p>Main file: </p>
  
  <pre><code>@synthesize addButton;
  - (void)viewDidLoad {
  
      NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3];
  
  
      addButton = [[UIBarButtonItem alloc]
                              initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
                              target:self action:@selector(btnNavAddPressed:)];
      addButton.style = UIBarButtonItemStyleBordered;
      [buttons addObject:addButton];
  
      [tools setItems:buttons animated:NO];
      [buttons release];
  
      self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
                                  initWithCustomView:tools];
  
      addButton.enabled = FALSE;
  
  - (void)dealloc {
      [addButton release];
  </code></pre>