我想弄清楚这段代码中的内存泄漏在哪里?
- (NSMutableArray *) fetchAidDetails:(NSNumber *) rowID {
NSMutableArray *list = [[NSMutableArray alloc] init];
FMDatabase *db = [[FMDatabase databaseWithPath:[self dbPath]] retain];
if(![db open]) {
[db release];
return [list autorelease];
}
NSString *query = [NSString stringWithFormat:@"select legislative_type, legislative_name from legislative_aid where official_id = %d", rowID.unsignedIntValue];
FMResultSet *result = [[db executeQueryWithFormat:query] retain];
while ([result next]) {
NSMutableDictionary *item = [[NSMutableDictionary alloc] init];
NSString *type = [[NSString alloc] init];
type = [result stringForColumn:@"legislative_type"];
[item setObject:type forKey:@"legislative_type"];
[type release];
NSString *party = [[NSString alloc] init];
party = [result stringForColumn:@"legislative_name"];
[item setObject:party forKey:@"legislative_name"];
[party release];
[list addObject:item];
[item release];
}
[result release];
[db close];
[db release];
return [list autorelease];
}
[item retainCount] 在 [item release] 之前给出 2,并且 [list autorelease] 将使引用计数为 0,我这里有什么问题吗?
请帮忙。
谢谢