This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch dj/malloc updated. glibc-2.23-548-g6ce1106
- From: dj at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 13 Jul 2016 15:03:32 -0000
- Subject: GNU C Library master sources branch dj/malloc updated. glibc-2.23-548-g6ce1106
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, dj/malloc has been updated
via 6ce11061fb60bb64742b19f626f2471f88554039 (commit)
from b856f645a2f58a3e224976167b4b1fb030d7967b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6ce11061fb60bb64742b19f626f2471f88554039
commit 6ce11061fb60bb64742b19f626f2471f88554039
Author: DJ Delorie <dj@delorie.com>
Date: Wed Jul 13 11:02:39 2016 -0400
Fix double-padding bug
The tcache was calling request2size which resulted in double padding.
Store tcache's copy in a separate variable to avoid this.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index a0bf866..70e7dc8 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3294,8 +3294,9 @@ __libc_malloc (size_t bytes)
void *victim;
#if USE_TCACHE
- bytes = request2size(bytes);
- int tc_idx = size2tidx (bytes);
+ /* int_free also calls request2size, be careful to not pad twice. */
+ size_t tbytes = request2size(bytes);
+ int tc_idx = size2tidx (tbytes);
if (tcache.initted == 0)
{
@@ -3312,7 +3313,7 @@ __libc_malloc (size_t bytes)
__MTB_TRACE_ENTRY (MALLOC,bytes,NULL);
#if USE_TCACHE
- if (bytes < MAX_TCACHE_SIZE
+ if (tbytes < MAX_TCACHE_SIZE
&& tcache.entries[tc_idx] != NULL
&& tcache.initted == 1)
{
@@ -3337,7 +3338,7 @@ __libc_malloc (size_t bytes)
/* This is fast but causes internal fragmentation, as it always
pulls large chunks but puts small chunks, leading to a large
backlog of small chunks. */
- if (bytes < MAX_TCACHE_SIZE
+ if (tbytes < MAX_TCACHE_SIZE
&& tcache.initted == 1)
{
void *ent;
@@ -3346,7 +3347,7 @@ __libc_malloc (size_t bytes)
size_t total_bytes;
int i;
- assert (tc_bytes >= bytes);
+ assert (tc_bytes >= tbytes);
if (tc_bytes < 2 * SIZE_SZ)
tc_bytes = 2 * SIZE_SZ;
-----------------------------------------------------------------------
Summary of changes:
malloc/malloc.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
hooks/post-receive
--
GNU C Library master sources