Ok I made these changes but I still have dozen of leaks on these lines
Here is a sample of my code
-(id)initSearchFilters{
self = [super init];
if ( self ) {
//init the search filters array
self.searchFilters = [[NSMutableArray alloc] init];
SearchCriteria *searchCriteriaTmp;
Filter *filterTmp1;
Filter *filterTmp2;
NSMutableArray *arrayTmp= [[NSMutableArray alloc] init];
//Price Range
arrayTmp = [[NSMutableArray alloc] init];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"any", @"value", @"any", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"100", @"value", @"$100", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"200", @"value", @"$200", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"300", @"value", @"$300", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"400", @"value", @"$400", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"500", @"value", @"$500", @"name", nil]];
filterTmp1 = [[Filter alloc] initWithLabel:@"Minimum Price" AndValue:0 AndListValue:arrayTmp AndWebServiceFieldName:@"price_min"];
filterTmp2 = [[Filter alloc] initWithLabel:@"Maximum Price" AndValue:0 AndListValue:arrayTmp AndWebServiceFieldName:@"price_max"];
searchCriteriaTmp = [[SearchCriteria alloc] initWithFilter1:filterTmp1 AndFilter2:filterTmp2 AndLabelSearchCriteria:@"Price Range" AndEnabled:NO];
[self.searchFilters addObject:searchCriteriaTmp];
[arrayTmp release];
arrayTmp=nil;
[filterTmp1 release];
filterTmp1=nil;
[filterTmp2 release];
filterTmp2=nil;
[searchCriteriaTmp release];
searchCriteriaTmp=nil;
//Item
arrayTmp = [[NSMutableArray alloc] init];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"1", @"value", @"item 1", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"2", @"value", @"item 2", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"3", @"value", @"item 3", @"name", nil]];
[arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"4", @"value", @"item 4", @"name", nil]];
filterTmp1 = [[Filter alloc] initWithLabel:@"Item" AndValue:0 AndListValue:arrayTmp AndWebServiceFieldName:@"item"];
searchCriteriaTmp = [[SearchCriteria alloc] initWithFilter1:filterTmp1 AndFilter2:nil AndLabelSearchCriteria:@"Item" AndEnabled:NO];
[self.searchFilters addObject:searchCriteriaTmp];
[arrayTmp release];
arrayTmp=nil;
[filterTmp1 release];
filterTmp1=nil;
[searchCriteriaTmp release];
searchCriteriaTmp=nil;
}
return self;
}
And my search criteria class
-(id)initWithFilter1:(Filter *)pFilter1 AndFilter2:(Filter *)pFilter2 AndLabelSearchCriteria:(NSString *)pLabelSearchCriteria AndEnabled:(BOOL)pEnabled{
self = [super init];
if (self != nil) {
self.filter1 = pFilter1;
self.filter2 = pFilter2;
self.labelSearchCriteria = pLabelSearchCriteria;
self.enabled =pEnabled;
}
return self;
}
- (void)dealloc
{
[filter1 release];
[filter2 release];
[labelSearchCriteria release];
[super dealloc];
}