fix: resolve memory leaks and crash in macOS camera and screen capture
All checks were successful
Deploy on Master Change / deploy (push) Successful in 42s
All checks were successful
Deploy on Master Change / deploy (push) Successful in 42s
This commit is contained in:
@@ -63,6 +63,7 @@ static unsigned char* CaptureFullDesktop(int* outLen, int quality) {
|
||||
NSData *jpegData = [rep representationUsingType:NSBitmapImageFileTypeJPEG properties:props];
|
||||
|
||||
if (!jpegData || jpegData.length == 0) {
|
||||
[rep release];
|
||||
*outLen = 0;
|
||||
return NULL;
|
||||
}
|
||||
@@ -70,6 +71,7 @@ static unsigned char* CaptureFullDesktop(int* outLen, int quality) {
|
||||
*outLen = (int)jpegData.length;
|
||||
unsigned char *buf = (unsigned char*)malloc(jpegData.length);
|
||||
memcpy(buf, jpegData.bytes, jpegData.length);
|
||||
[rep release];
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user