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

This commit is contained in:
2026-07-01 13:11:59 +07:00
parent 44888520cb
commit d94c1733be
3 changed files with 96 additions and 28 deletions

View File

@@ -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;
}
}