summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Turner <digit@android.com>2010-03-16 17:26:44 -0700
committerAndroid Code Review <code-review@android.com>2010-03-16 17:26:44 -0700
commita9c41a8e0a62f70a37f7040740a9b1ef06a66612 (patch)
tree6cb6780bb885e4431d7fc16d9a651cbea2fe4cf4
parent3f192f55f06610a4aff8ce88548cfa4d1607f0e3 (diff)
parent291100c795fc98f4a1320e7de0dbef2615cd8fb9 (diff)
downloadbionic-a9c41a8e0a62f70a37f7040740a9b1ef06a66612.zip
bionic-a9c41a8e0a62f70a37f7040740a9b1ef06a66612.tar.gz
bionic-a9c41a8e0a62f70a37f7040740a9b1ef06a66612.tar.bz2
Merge "bionic: remove unneeded variable from chk_realloc()"
-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);
}