summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Goddard Rosa <andre.goddard@gmail.com>2010-02-05 16:32:56 -0200
committerAndré Goddard Rosa <andre.goddard@gmail.com>2010-02-05 16:32:56 -0200
commit291100c795fc98f4a1320e7de0dbef2615cd8fb9 (patch)
tree5600a5c95c98ab0e80442f90d65a060fa5b843f9
parent95604529ec25fe7923ba88312c590f38aa5e3d9e (diff)
downloadbionic-291100c795fc98f4a1320e7de0dbef2615cd8fb9.zip
bionic-291100c795fc98f4a1320e7de0dbef2615cd8fb9.tar.gz
bionic-291100c795fc98f4a1320e7de0dbef2615cd8fb9.tar.bz2
bionic: remove unneeded variable from chk_realloc()
... and simplify the generated code. Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
-rw-r--r--libc/bionic/malloc_leak.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libc/bionic/malloc_leak.c b/libc/bionic/malloc_leak.c
index 305f954..ad1d2b4 100644
--- a/libc/bionic/malloc_leak.c
+++ b/libc/bionic/malloc_leak.c
@@ -665,8 +665,9 @@ void* chk_realloc(void* mem, size_t bytes)
}
if (new_buffer) {
- size_t size = (bytes < old_bytes)?(bytes):(old_bytes);
- memcpy(new_buffer, mem, size);
+ if (bytes > old_bytes)
+ bytes = old_bytes;
+ memcpy(new_buffer, mem, bytes);
chk_free(mem);
}