[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r20885 - in /fsf/glibc-2_16-branch/libc: ChangeLog NEWS malloc/arena.c



Author: eglibc
Date: Thu Sep 27 00:02:23 2012
New Revision: 20885

Log:
Import glibc-2.16 for 2012-09-27

Modified:
    fsf/glibc-2_16-branch/libc/ChangeLog
    fsf/glibc-2_16-branch/libc/NEWS
    fsf/glibc-2_16-branch/libc/malloc/arena.c

Modified: fsf/glibc-2_16-branch/libc/ChangeLog
==============================================================================
--- fsf/glibc-2_16-branch/libc/ChangeLog (original)
+++ fsf/glibc-2_16-branch/libc/ChangeLog Thu Sep 27 00:02:23 2012
@@ -1,3 +1,9 @@
+2012-09-24  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	[BZ #14562]
+	* malloc/arena.c (heap_trim): Properly get fencepost and adjust
+	new chunk size with MALLOC_ALIGN_MASK.
+
 2012-08-29  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
 	[BZ #14476]

Modified: fsf/glibc-2_16-branch/libc/NEWS
==============================================================================
--- fsf/glibc-2_16-branch/libc/NEWS (original)
+++ fsf/glibc-2_16-branch/libc/NEWS Thu Sep 27 00:02:23 2012
@@ -9,7 +9,7 @@
 
 * The following bugs are resolved with this release:
 
-  14195, 14459, 14476
+  14195, 14459, 14476, 14562
 
 Version 2.16
 

Modified: fsf/glibc-2_16-branch/libc/malloc/arena.c
==============================================================================
--- fsf/glibc-2_16-branch/libc/malloc/arena.c (original)
+++ fsf/glibc-2_16-branch/libc/malloc/arena.c Thu Sep 27 00:02:23 2012
@@ -652,15 +652,19 @@
   unsigned long pagesz = GLRO(dl_pagesize);
   mchunkptr top_chunk = top(ar_ptr), p, bck, fwd;
   heap_info *prev_heap;
-  long new_size, top_size, extra;
+  long new_size, top_size, extra, prev_size, misalign;
 
   /* Can this heap go away completely? */
   while(top_chunk == chunk_at_offset(heap, sizeof(*heap))) {
     prev_heap = heap->prev;
-    p = chunk_at_offset(prev_heap, prev_heap->size - (MINSIZE-2*SIZE_SZ));
+    prev_size = prev_heap->size - (MINSIZE-2*SIZE_SZ);
+    p = chunk_at_offset(prev_heap, prev_size);
+    /* fencepost must be properly aligned.  */
+    misalign = ((long) p) & MALLOC_ALIGN_MASK;
+    p = chunk_at_offset(prev_heap, prev_size - misalign);
     assert(p->size == (0|PREV_INUSE)); /* must be fencepost */
     p = prev_chunk(p);
-    new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ);
+    new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ) + misalign;
     assert(new_size>0 && new_size<(long)(2*MINSIZE));
     if(!prev_inuse(p))
       new_size += p->prev_size;

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits