Skip to content

Commit

Permalink
epoch: Correct handling of null ptr returned from alloc::alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Apr 28, 2021
1 parent 7928d11 commit 8f487bd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crossbeam-epoch/src/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ impl<T> Pointable for [MaybeUninit<T>] {
let align = mem::align_of::<Array<T>>();
let layout = alloc::Layout::from_size_align(size, align).unwrap();
let ptr = alloc::alloc(layout) as *mut Array<T>;
if ptr.is_null() {
alloc::handle_alloc_error(layout);
}
(*ptr).size = size;
ptr as usize
}
Expand Down

0 comments on commit 8f487bd

Please sign in to comment.