Skip to content

Commit df20a68

Browse files
authored
use Box::into_raw instead of mem-forget-in-disguise (#458)
1 parent 8758a1a commit df20a68

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/bytes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,7 @@ impl From<Vec<u8>> for Bytes {
806806

807807
let slice = vec.into_boxed_slice();
808808
let len = slice.len();
809-
let ptr = slice.as_ptr();
810-
drop(Box::into_raw(slice));
809+
let ptr = Box::into_raw(slice) as *mut u8;
811810

812811
if ptr as usize & 0x1 == 0 {
813812
let data = ptr as usize | KIND_VEC;

0 commit comments

Comments
 (0)