Skip to content

Commit

Permalink
fixed some pretty silly memory leaks
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan 'Wolf' Rentzsch <jwr.git@redshed.net>
  • Loading branch information
Simone Manganelli authored and rentzsch committed Jul 3, 2009
1 parent 76670d2 commit 8797bb2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Plugin/CTFURLConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand All @@ -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];
Expand Down

0 comments on commit 8797bb2

Please sign in to comment.