SwiftPrivilegedHelper
SwiftPrivilegedHelper copied to clipboard
Memory leak when deserializing AuthorizationExternalForm
I believe you should be calling .deallocate on UnsafeMutablePointer instances, right? With respect to HelperAuthorization.swift file.
Alternatively, use a cleaner code:
var externalForm = AuthorizationExternalForm()
withUnsafeMutableBytes(of: &externalForm) {
data.copyBytes(to: $0)
return
}
Thank you for this, you are correct that the unsafe pointers should be deallocated. And your example makes it even better, so thank you for helping me with that.