summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}