diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-11-26 09:44:55 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-11-26 16:49:49 -0800 |
| commit | 989d7a78bbf6e2354911d37653d5bb1cb018742c (patch) | |
| tree | c3978cbfef157b84c2995e18db5649a29fd151ee /src/libcollections | |
| parent | 6939e4f58c86fd80374b4a3ae9e398df99b9dcad (diff) | |
| parent | c9816be35a1bcdef915498939a1f62c18dee1c04 (diff) | |
| download | rust-989d7a78bbf6e2354911d37653d5bb1cb018742c.tar.gz rust-989d7a78bbf6e2354911d37653d5bb1cb018742c.zip | |
rollup merge of #19308: thestinger/oom
Closes #19305
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/vec.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index acbb28293fd..5edd3d0b780 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -187,6 +187,7 @@ impl<T> Vec<T> { let size = capacity.checked_mul(mem::size_of::<T>()) .expect("capacity overflow"); let ptr = unsafe { allocate(size, mem::min_align_of::<T>()) }; + if ptr.is_null() { ::alloc::oom() } Vec { ptr: ptr as *mut T, len: 0, cap: capacity } } } |
