Merge pull request #2624 from zhongwuzw/nil_image_data

Nil imageData before decode process to free memory
This commit is contained in:
DreamPiggy 2019-02-26 11:13:28 +08:00 committed by GitHub
commit bede907ab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -201,7 +201,6 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
} else {
[self callCompletionBlocksWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorUnknown userInfo:@{NSLocalizedDescriptionKey : @"Task can't be initialized"}]];
[self done];
return;
}
}
@ -403,6 +402,7 @@ didReceiveResponse:(NSURLResponse *)response
* If you specified to use `NSURLCache`, then the response you get here is what you need.
*/
__block NSData *imageData = [self.imageData copy];
self.imageData = nil;
if (imageData) {
/** if you specified to only use cached data via `SDWebImageDownloaderIgnoreCachedResponse`,
* then we should check if the cached data is equal to image data