Skip to content

Commit

Permalink
use Box::into_raw instead of mem-forget-in-disguise (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung authored Dec 31, 2020
1 parent 8758a1a commit df20a68
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit df20a68

Please sign in to comment.