Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

Commit

Permalink
Fix possible memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
hewigovens committed May 15, 2016
1 parent 046fc10 commit e099f9b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Alcatraz/Helpers/ATZDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@interface ATZDownloader()
@property (strong, nonatomic) NSMutableDictionary *callbacks;
@property (strong, nonatomic) NSURLSession *urlSession;
@property (strong, nonatomic, readonly) NSURLSession *urlSession;
@end


Expand Down Expand Up @@ -135,16 +135,14 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
#pragma mark - Private

- (NSURLSession *)urlSession {
if (_urlSession) return _urlSession;

_urlSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
return _urlSession;
static dispatch_once_t onceToken;
static NSURLSession *session = nil;
dispatch_once(&onceToken, ^{
session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
});
return session;
}





@end

0 comments on commit e099f9b

Please sign in to comment.