i300/TweetBotTabBar — Issue #3: TBTabBar and TBTabButton potential memory leaks
Author: lucianoenrico
Created: 2012-02-25 13:39:11+00:00
State: open

Hi,
the static analyzer complains about the following code in TBTabButton.m:

```
-(id)initWithIcon:(UIImage*)nIcon {
self = [super init];
if (self) {
self.icon = nIcon;
self.light = [[TBTabNotification alloc] initWithFrame:CGRectMake(0, 0, 63, 4)];
self.notifications = [[NSMutableArray alloc] init];
}
return self;
}
```

Here both light and notifications are properties with retain. So I think the must be auto released after the assignment, like this:

```
-(id)initWithIcon:(UIImage*)nIcon {
self = [super init];
if (self) {
self.icon = nIcon;
self.light = [[[TBTabNotification alloc] initWithFrame:CGRectMake(0, 0, 63, 4)] autorelease];
self.notifications = ][[NSMutableArray alloc] init] autorelease];
}
return self;
}
```

The same happens in TBTabBar.m (use Analyze) to find the exact position.

Can you please verify and fix this?

thank you