Hello,
I have the following code:
+ (BOOL)updateStatus:(NSString *)status forUsername:(NSString *)username withPassword:(NSString *)password {
NSURL *loginURL = [NSURL URLWithString:@"XYZ"];
ASIFormDataRequest *loginRequest = [[ASIFormDataRequest requestWithURL:loginURL] retain];
[loginRequest setPostValue:@VALUE forKey:@"SOME_KEY"];
[loginRequest setPostValue:username forKey:@"username"];
[loginRequest setPostValue:password forKey:@"password"];
[loginRequest startSynchronous];
int loginStatusCode = [loginRequest responseStatusCode];
[loginRequest release];
if (loginStatusCode == 200) { //if we were able to login
NSURL *updateURL = [NSURL URLWithString:@"ABC"];
ASIFormDataRequest *updateRequest = [[ASIFormDataRequest requestWithURL:updateURL] retain];
[updateRequest setPostValue:@VALUE forKey:@"SOME_KEY"];
[updateRequest setPostValue:VALUE forKey:@"SOME_KEY"];
[updateRequest setPostValue:@"VALUE" forKey:@"SOME_KEY"];
[updateRequest startSynchronous];
int statusCode = [updateRequest responseStatusCode];
[updateRequest release];
NSURL *logoutURL = [NSURL URLWithString:@"ABC"];
ASIFormDataRequest *logoutRequest = [ASIFormDataRequest requestWithURL:logoutURL];
[logoutRequest setPostValue:VALUE forKey:@"KEY"];
[logoutRequest startSynchronous];
[logoutRequest release];
if (statusCode == 200) { /
return YES;
} else {
return NO;
}
} else {
return NO;
}
}
I run the code on the Simulator with Instruments and it reports the following leak: pointing to the following line:
NSURL *loginURL = [NSURL URLWithString:@"XYZ"];
I am pretty sure that I don't have to release NSURL (due to the convention that I need to release only the objects created with init or copy). Am I wrong? or is there something else wrong with the code?