From 291100c795fc98f4a1320e7de0dbef2615cd8fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 5 Feb 2010 16:32:56 -0200 Subject: [PATCH] bionic: remove unneeded variable from chk_realloc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... and simplify the generated code. Signed-off-by: André Goddard Rosa --- libc/bionic/malloc_leak.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libc/bionic/malloc_leak.c b/libc/bionic/malloc_leak.c index 305f954e7..ad1d2b420 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); }