Use reference of log file string instead of take ownership [FFI]

This commit is contained in:
Jackson Coxson
2025-03-30 16:15:27 -06:00
parent 6b9fa90219
commit 006253170a

View File

@@ -1,7 +1,7 @@
// Jackson Coxson
use std::{
ffi::{CString, c_char},
ffi::{CStr, CString, c_char},
fs::File,
};
@@ -46,7 +46,7 @@ pub unsafe extern "C" fn idevice_init_logger(
));
if !file_path.is_null() {
let file_path = match unsafe { CString::from_raw(file_path) }.to_str() {
let file_path = match unsafe { CStr::from_ptr(file_path) }.to_str() {
Ok(f) => f.to_string(),
Err(_) => {
return IdeviceLoggerError::InvalidPathString;