diff options
| author | gnzlbg <gonzalobg88@gmail.com> | 2017-10-25 14:46:02 +0200 |
|---|---|---|
| committer | gnzlbg <gonzalobg88@gmail.com> | 2017-10-25 14:46:02 +0200 |
| commit | f39594d4bb719b9af7fcb56b7e4cd5a8868a8c50 (patch) | |
| tree | a820ea16f4fd9f789c1cc8eb8a05195978592013 /src/liballoc_jemalloc | |
| parent | e1a71e7b8a15026b1a8067135fccf3d18be0203d (diff) | |
| download | rust-f39594d4bb719b9af7fcb56b7e4cd5a8868a8c50.tar.gz rust-f39594d4bb719b9af7fcb56b7e4cd5a8868a8c50.zip | |
move sallocx and excess into not null branch
Diffstat (limited to 'src/liballoc_jemalloc')
| -rw-r--r-- | src/liballoc_jemalloc/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index c10af35a94b..09666bd0e62 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -229,13 +229,14 @@ mod contents { let flags = align_to_flags(new_align); let ptr = rallocx(ptr as *mut c_void, new_size, flags) as *mut u8; - let alloc_size = sallocx(ptr as *mut c_void, flags); if ptr.is_null() { let layout = Layout::from_size_align_unchecked(new_size, new_align); ptr::write(err as *mut AllocErr, AllocErr::Exhausted { request: layout }); + } else { + let alloc_size = sallocx(ptr as *mut c_void, flags); + *excess = alloc_size; } - *excess = alloc_size; ptr } |
