Permalink
Browse files

fixed some pretty silly memory leaks

  • Loading branch information...
1 parent 148ece9 commit 4eb03471f0135edad8b82c820a27bc965f4b3c31 Simone Manganelli committed Jul 3, 2009
Showing with 8 additions and 5 deletions.
  1. +8 −5 Plugin/CTFURLConnection.m
@@ -33,9 +33,10 @@ - (NSHTTPURLResponse *)getURLResponseHeaders:(NSURL *)URL
[request setValue:@"bytes=0-1" forHTTPHeaderField:@"Range"];
[NSThread detachNewThreadSelector:@selector(startRequest:) toTarget:self withObject:request];
-
+ [request release];
+
[theLock lockWhenCondition:1];
- *error = errorToReturn;
+ if (error) (*error) = errorToReturn;
return [responseToReturn autorelease];
}
@@ -55,10 +56,12 @@ - (void)startRequest:(NSURLRequest *)request;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[request retain];
- [[NSURLConnection alloc] initWithRequest:request
- delegate:self
- startImmediately:YES];
+
+ NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request
+ delegate:self
+ startImmediately:YES];
[[NSRunLoop currentRunLoop] run];
+ [connection release];
[request release];
[pool drain];

0 comments on commit 4eb0347

Please sign in to comment.