Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant