Nil imageData before decode process to free memory

This commit is contained in:
zhongwuzw 2019-02-21 22:28:23 +08:00
parent a54af636a8
commit 50f9ddd5a8
1 changed files with 1 additions and 1 deletions

View File

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