mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-09-09 00:00:10 +02:00
use Box::into_raw instead of mem-forget-in-disguise (#458)
This commit is contained in:
+1
-2
@@ -806,8 +806,7 @@ impl From<Vec<u8>> for Bytes {
|
|||||||
|
|
||||||
let slice = vec.into_boxed_slice();
|
let slice = vec.into_boxed_slice();
|
||||||
let len = slice.len();
|
let len = slice.len();
|
||||||
let ptr = slice.as_ptr();
|
let ptr = Box::into_raw(slice) as *mut u8;
|
||||||
drop(Box::into_raw(slice));
|
|
||||||
|
|
||||||
if ptr as usize & 0x1 == 0 {
|
if ptr as usize & 0x1 == 0 {
|
||||||
let data = ptr as usize | KIND_VEC;
|
let data = ptr as usize | KIND_VEC;
|
||||||
|
|||||||
Reference in New Issue
Block a user