about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOliver Schneider <oli-obk@users.noreply.github.com>2017-07-18 23:34:09 +0200
committerGitHub <noreply@github.com>2017-07-18 23:34:09 +0200
commit2d5c4196f17fc8d09ac2c434f2a49cdb07e7f4bc (patch)
treebcb6fc3810fcff18e688ed83020e54b654591a5c /src
parent824438bda99462871f81ae8723dd53f6c2b9f6ca (diff)
parentff9192e3469bd0eca4207a6c55b372384d5d7f5a (diff)
downloadrust-2d5c4196f17fc8d09ac2c434f2a49cdb07e7f4bc.tar.gz
rust-2d5c4196f17fc8d09ac2c434f2a49cdb07e7f4bc.zip
Merge pull request #254 from RalfJung/dangling
Remove reundant dangling checks in {r,d}eallocate
Diffstat (limited to 'src')
-rw-r--r--src/memory.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/memory.rs b/src/memory.rs
index 6b181e31063..cf7f969be8e 100644
--- a/src/memory.rs
+++ b/src/memory.rs
@@ -230,7 +230,7 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
     pub fn reallocate(&mut self, ptr: MemoryPointer, old_size: u64, old_align: u64, new_size: u64, new_align: u64, kind: Kind) -> EvalResult<'tcx, MemoryPointer> {
         use std::cmp::min;
 
-        if ptr.offset != 0 || self.get(ptr.alloc_id).is_err() {
+        if ptr.offset != 0 {
             return Err(EvalError::ReallocateNonBasePtr);
         }
         if let Ok(alloc) = self.get(ptr.alloc_id) {
@@ -248,7 +248,7 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
     }
 
     pub fn deallocate(&mut self, ptr: MemoryPointer, size_and_align: Option<(u64, u64)>, kind: Kind) -> EvalResult<'tcx> {
-        if ptr.offset != 0 || self.get(ptr.alloc_id).is_err() {
+        if ptr.offset != 0 {
             return Err(EvalError::DeallocateNonBasePtr);
         }