Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when deserializing AuthorizationExternalForm #13

Open
paya-cz opened this issue Apr 10, 2019 · 1 comment
Open

Memory leak when deserializing AuthorizationExternalForm #13

paya-cz opened this issue Apr 10, 2019 · 1 comment

Comments

@paya-cz
Copy link

paya-cz commented Apr 10, 2019

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
}
@erikberglund
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants