mirror of
https://github.com/openharmony/third_party_rust_bytes.git
synced 2026-07-01 22:24:07 -04: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 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;
|
||||
|
||||
Reference in New Issue
Block a user