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

Possible memory leak (find into_raw, but no from_raw) #92

Open
lucky1024 opened this issue Mar 26, 2021 · 0 comments
Open

Possible memory leak (find into_raw, but no from_raw) #92

lucky1024 opened this issue Mar 26, 2021 · 0 comments

Comments

@lucky1024
Copy link

As we known, we can use into_raw to transfer ownership of a string to a C caller. But we also need use from_raw to retake pointer to free memory.

into_raw/from_raw is a pair, but I only find into_raw in source code, and can not find from_raw. Failure to call from_raw will lead to a memory leak.

https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_raw

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

No branches or pull requests

1 participant