In a Utilities class, I have the following method:
+ (Division *) getNationalDivision
{
Division *defaultDivision = [[[Division alloc] init] autorelease];
defaultDivision.Id = 0;
defaultDivision.name = @"National";
return defaultDivision;
}
I have a division allocted in my app delegate to store the division throughout the app, so in one of my view controllers I have:
appDel.currentDivision = [[Utilities getNationalDivision] retain];
In the app delegate .h I have:
@property (nonatomic, retain) Division *currentDivision;
In the app delegate .m I have:
currentDivision = [[Division alloc] init];
When I analyze, I get potential leak of an object that points to the above line. Any ideas? If I dont retain the national division, it doesnt work. Also, just to note, everything works fine. I just want to make sure I am not leaking something.
The retain is done by the synthesized property accessor method. Remove it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With