diff options
| author | bors <bors@rust-lang.org> | 2016-04-15 14:51:16 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-04-15 14:51:16 -0700 |
| commit | 576229fea054105f1f3a49ca5f31f5f4983f5266 (patch) | |
| tree | 736d1a8f05d181f27e51d53ef49e4d77e05bb861 /src/liballoc_system | |
| parent | 9debf51f4b8a5d437df1abca57c5a58c45297b60 (diff) | |
| parent | e563359396928453db81141bf12dae04a567f2e9 (diff) | |
| download | rust-576229fea054105f1f3a49ca5f31f5f4983f5266.tar.gz rust-576229fea054105f1f3a49ca5f31f5f4983f5266.zip | |
Auto merge of #33005 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests - Successful merges: #32923, #32926, #32929, #32931, #32935, #32945, #32946, #32964, #32970, #32973, #32997 - Failed merges:
Diffstat (limited to 'src/liballoc_system')
| -rw-r--r-- | src/liballoc_system/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs index 6a62e00d311..ca4c9bfd954 100644 --- a/src/liballoc_system/lib.rs +++ b/src/liballoc_system/lib.rs @@ -96,8 +96,10 @@ mod imp { libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8 } else { let new_ptr = allocate(size, align); - ptr::copy(ptr, new_ptr, cmp::min(size, old_size)); - deallocate(ptr, old_size, align); + if !new_ptr.is_null() { + ptr::copy(ptr, new_ptr, cmp::min(size, old_size)); + deallocate(ptr, old_size, align); + } new_ptr } } |
