diff --git a/src/ffi_util.rs b/src/ffi_util.rs index 07c3bff..9256845 100644 --- a/src/ffi_util.rs +++ b/src/ffi_util.rs @@ -18,7 +18,7 @@ use std::ffi::CStr; pub fn error_message(ptr: *const c_char) -> String { let cstr = unsafe { CStr::from_ptr(ptr as *const _) }; - let s = String::from_utf8_lossy(cstr.to_bytes()).into(); + let s = String::from_utf8_lossy(cstr.to_bytes()).into_owned(); unsafe { libc::free(ptr as *mut c_void); }