Skip to content

Commit ca3d169

Browse files
committed
Fixed memory leaks.
1 parent 6ef9a93 commit ca3d169

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Classes/ImageFilter.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ - (UIImage*) applyFilter:(FilterCallback)filter context:(void*)context
8484
int length = CFDataGetLength(m_DataRef);
8585
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef);
8686
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit);
87+
CFRelease(m_DataRefEdit);
8788

8889
for (int i=0; i<length; i+=4)
8990
{
@@ -425,6 +426,7 @@ - (UIImage*) applyBlendFilter:(FilterBlendCallback)filter other:(UIImage*)other
425426
int length = CFDataGetLength(m_DataRef);
426427
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef);
427428
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit);
429+
CFRelease(m_DataRefEdit);
428430

429431
CGImageRef otherImage = other.CGImage;
430432
CFDataRef m_OtherDataRef = CGDataProviderCopyData(CGImageGetDataProvider(otherImage));
@@ -773,10 +775,12 @@ - (UIImage*) applyConvolve:(NSArray*)kernel
773775
int length = CFDataGetLength(m_DataRef);
774776
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef);
775777
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit);
778+
CFRelease(m_DataRefEdit);
776779

777780
int outputLength = CFDataGetLength(m_OutDataRef);
778781
CFMutableDataRef m_OutDataRefEdit = CFDataCreateMutableCopy(NULL,outputLength,m_DataRef);
779782
UInt8 * m_OutPixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_OutDataRefEdit);
783+
CFRelease(m_OutDataRefEdit);
780784

781785
int h = CGImageGetHeight(inImage);
782786
int w = CGImageGetWidth(inImage);
@@ -961,6 +965,7 @@ - (UIImage*) vignette
961965
int length = CFDataGetLength(m_DataRef);
962966
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef);
963967
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit);
968+
CFRelease(m_DataRefEdit);
964969
memset(m_PixelBuf,0,length);
965970

966971
CGContextRef ctx = CGBitmapContextCreate(m_PixelBuf,
@@ -1000,6 +1005,7 @@ - (UIImage*) darkVignette
10001005
int length = CFDataGetLength(m_DataRef);
10011006
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef);
10021007
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit);
1008+
CFRelease(m_DataRefEdit);
10031009
memset(m_PixelBuf,0,length);
10041010

10051011
CGContextRef ctx = CGBitmapContextCreate(m_PixelBuf,

0 commit comments

Comments
 (0)