From c7a444f4a7f1f03c99feda48b81ada08027a00ef Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Wed, 2 Aug 2017 17:14:37 +0800 Subject: [PATCH] Fix CFRelease on NULL if CGImageSourceRef create failed Fix CFRelease on NULL if CGImageSourceRef create failed, this may happen on progressive download with wrong image data --- SDWebImage/SDWebImageDownloaderOperation.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 6c7dd55f..b8c78ba4 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -376,7 +376,9 @@ didReceiveResponse:(NSURLResponse *)response } } - CFRelease(imageSource); + if (imageSource) { + CFRelease(imageSource); + } } for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {