diff --git a/ChangeLog b/ChangeLog index 2a11522a99..ea0c48f850 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Will Newton + + * malloc/malloc.c (systrim): If extra is zero then return + early. + 2014-06-19 Siddhesh Poyarekar * benchtests/Makefile ($(objpfx)bench-%.c): Remove $(.). 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.