Skip to content

Commit 93dce5a

Browse files
bors[bot]taiki-e
andauthored
Merge #690
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>
2 parents 7928d11 + 8f487bd commit 93dce5a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crossbeam-epoch/src/atomic.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ impl<T> Pointable for [MaybeUninit<T>] {
252252
let align = mem::align_of::<Array<T>>();
253253
let layout = alloc::Layout::from_size_align(size, align).unwrap();
254254
let ptr = alloc::alloc(layout) as *mut Array<T>;
255+
if ptr.is_null() {
256+
alloc::handle_alloc_error(layout);
257+
}
255258
(*ptr).size = size;
256259
ptr as usize
257260
}

0 commit comments

Comments
 (0)