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
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