···1919import kotlinx.cinterop.value
2020import platform.AVFoundation.AVCaptureVideoOrientationLandscapeRight
2121import platform.AVFoundation.AVCaptureVideoPreviewLayer
2222+import platform.CoreFoundation.CFRelease
2323+import platform.CoreFoundation.CFRetain
2224import platform.CoreGraphics.CGImageGetHeight
2325import platform.CoreGraphics.CGImageGetWidth
2426import platform.CoreGraphics.CGImageRef
···372374 onSkeletonProcessed(null)
373375 return
374376 }
377377+ val retainedBuffer = CFRetain(buffer)
375378 val width = 480uL // You may want to get actual width from buffer if needed
376379 val height = 360uL // You may want to get actual height from buffer if needed
377380 memScoped {
···553556 handler.performRequests(
554557 listOfNotNull(requestForObjects, requestForSkeleton), errorPtr.ptr
555558 )
559559+ CFRelease(retainedBuffer)
556560 if (errorPtr.value != null) {
557561 //println("Error performing object detection request: ${errorPtr.value}")
558562 onObjectsProcessed(emptyList())