Closed pnehrer closed 2 months ago
The cstr macro uses CString::into_raw() to get the c-compatible string pointer.
cstr
CString::into_raw()
However, per Rust doc, into_raw actually leaks the pointer if it isn't reclaimed and deallocated using from_raw.
into_raw
from_raw
This PR changes the macro and its usage to:
as_ptr
The
cstr
macro usesCString::into_raw()
to get the c-compatible string pointer.However, per Rust doc,
into_raw
actually leaks the pointer if it isn't reclaimed and deallocated usingfrom_raw
.This PR changes the macro and its usage to:
as_ptr
)as_ptr
to the c functions