use Box::into_raw instead of mem-forget-in-disguise (#458)

This commit is contained in:
Ralf Jung
2020-12-31 15:07:28 +01:00
committed by GitHub
parent 4921a32c48
commit caff82bb54
+1 -2
View File
@@ -806,8 +806,7 @@ impl From<Vec<u8>> for Bytes {
let slice = vec.into_boxed_slice();
let len = slice.len();
let ptr = slice.as_ptr();
drop(Box::into_raw(slice));
let ptr = Box::into_raw(slice) as *mut u8;
if ptr as usize & 0x1 == 0 {
let data = ptr as usize | KIND_VEC;