Skip to content

Loading…

memory leak #29

Open
vovasty opened this Issue · 2 comments

3 participants

@vovasty
diff --git a/Appirater.m b/Appirater.m
index 0d2bb62..bbcd13e 100644
--- a/Appirater.m
+++ b/Appirater.m
@@ -85,7 +85,7 @@ NSString *templateReviewURL = @"itms-apps://ax.itunes.apple.com/WebObjects/MZSto

        NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
        NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL  cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0];
-       NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:self];
+       NSURLConnection *testConnection = [[[NSURLConnection alloc] initWithRequest:testRequest delegate:self] autorelease];

     return ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
 }
@kimhunter

Or even easier

NSURLConnection *testConnection = [NSURLConnection connectionWithRequest:testRequest delegate:self];

@nacho4d

I made it this way:

  ...
  NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:nil];
  BOOL res = ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
  [testConnection release];
  return res;

Note that I've changed the delegate to nil because Appirater does not implement any delegate method of NSURLConnectionDelegate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.