iOS: fix memory leak

This commit is contained in:
pengfei.zhou
2022-02-21 14:53:14 +08:00
committed by osborn
parent 37197a8f45
commit e55b64158c
2 changed files with 12 additions and 13 deletions

View File

@@ -761,7 +761,7 @@ - (NSData *)getImagePixels {
CGColorSpaceRelease(colorSpace);
CGContextRelease(contextRef);
return [[NSData alloc] initWithBytesNoCopy:imageData length:width * height * bytesPerPixel];
return [[NSData alloc] initWithBytesNoCopy:imageData length:width * height * bytesPerPixel freeWhenDone:YES];
}
- (void)dealloc {