Skip to content

Commit

Permalink
Merge #690
Browse files Browse the repository at this point in the history
690: epoch: Correct handling of null ptr returned from alloc::alloc r=jeehoonkang a=taiki-e

Fixes #689 

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e committed Apr 28, 2021
2 parents 7928d11 + 8f487bd commit 93dce5a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crossbeam-epoch/src/atomic.rs
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 93dce5a

Please sign in to comment.