Hi, What is causing the leaks in this code? I really cannot understand it. On thes lines: 1: NSMutableArray * days = [[NSMutableArray alloc]init]; 2: [dic setObject:days forKey:key]; 3: [days addObject:value];
The whole method:
-(void) addValueToDictionary: (NSMutableDictionary *) dic withValue: (NSNumber *) value forKey: (NSString *) key {
NSMutableArray * days = [dic objectForKey:key];
if (days == nil) {
NSMutableArray * days = [[NSMutableArray alloc]init];
[days addObject:value];
[dic setObject:days forKey:key];
[days release];
days = nil;
}
else {
[days addObject:value];
}
}
BR //Christoffer