Skip to content

Commit

Permalink
tests: fix SB violation in LeakedBuffers (#5322)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Dec 29, 2022
1 parent 4a4f80c commit ef02242
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tokio/tests/support/leaked_buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ impl LeakedBuffers {
}
}
pub unsafe fn create<'a>(&mut self, size: usize) -> &'a mut [u8] {
let mut new_mem = vec![0u8; size].into_boxed_slice();
let slice = std::slice::from_raw_parts_mut(new_mem.as_mut_ptr(), new_mem.len());
let new_mem = vec![0u8; size].into_boxed_slice();
self.leaked_vecs.push(new_mem);
slice
let new_mem = self.leaked_vecs.last_mut().unwrap();
std::slice::from_raw_parts_mut(new_mem.as_mut_ptr(), new_mem.len())
}
}

0 comments on commit ef02242

Please sign in to comment.