Skip to content

Commit 2ca0e94

Browse files
committed
fix: free slices with CString::from_raw instead of Box
1 parent 057d85e commit 2ca0e94

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

datadog-sidecar-ffi/src/span.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,10 @@ pub unsafe extern "C" fn ddog_free_charslice(slice: CharSlice<'static>) {
218218
return;
219219
}
220220

221-
// Safety: the owned char slices returned by functions of this API are `Box`-allocated.
221+
// Safety: the owned char slices returned by functions comes from `CString::into_raw` in
222+
// `ddog_span_debug_log`.
222223
unsafe {
223-
let _ = Box::from_raw(ptr as *mut c_char);
224+
let _ = CString::from_raw(ptr as *mut c_char);
224225
}
225226
}
226227

0 commit comments

Comments
 (0)