mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
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.
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user