I have a memory leak when I call the following method
- (NSArray *) children
{
NSArray *children = [node objectForKey:TFHppleNodeChildrenKey];
NSMutableArray *hpple = [NSMutableArray arrayWithCapacity:[children count]];
for(NSDictionary *child in children) {
[hpple addObject:[[TFHppleElement alloc] initWithNode:child]];
[child release];
}
return hpple;
}
I get a memory leak on TFHppleElement, I alloc this but I not sure of the best way to release it in this context? The TFHppleElement initWithNode looks like this:
- (id) initWithNode:(NSDictionary *) theNode
{
if (!(self = [super init]))
return nil;
[theNode retain];
node = theNode;
return self;
}
You can simply autorelease that object to make runtime responsible for releasing it: