summaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorWill Newton <will.newton@linaro.org>2014-06-13 16:37:12 +0100
committerWill Newton <will.newton@linaro.org>2014-06-19 14:34:08 +0100
commit51a7380b8968251a49a4c5b0bc7ed1af5b0512c6 (patch)
treefa60b24efaa944845bb679eb09cbdced8b6b337d /malloc
parent91b84fe588238289e734ee05cfff26482c8f56ac (diff)
downloadglibc-51a7380b8968251a49a4c5b0bc7ed1af5b0512c6.tar.gz
malloc/malloc.c: Avoid calling sbrk unnecessarily with zero
Due to my bad review suggestion for the fix for BZ #15089 a check was removed from systrim to prevent sbrk being called with a zero argument. Add the check back to avoid this useless work. ChangeLog: 2014-06-19 Will Newton <will.newton@linaro.org> * malloc/malloc.c (systrim): If extra is zero then return early.
Diffstat (limited to 'malloc')
-rw-r--r--malloc/malloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index d8fd8b49e4..41fd76a29e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2749,6 +2749,9 @@ systrim (size_t pad, mstate av)
/* Release in pagesize units, keeping at least one page */
extra = (top_area - pad) & ~(pagesz - 1);
+ if (extra == 0)
+ return 0;
+
/*
Only proceed if end of memory is where we last set it.
This avoids problems if there were foreign sbrk calls.