Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 2003d1abfa0c20ee77815f0da33e2c1c > files > 63

glibc-2.5-49.el5_5.5.src.rpm

2007-10-01  Ulrich Drepper  <drepper@redhat.com>

	[BZ #5071]
	* malloc/malloc.c (mremap_chunk): Avoid resizing of new block has
	the same number of pages.
	Patch by Tomash Brechko <tomash.brechko@gmail.com>.

--- libc/malloc/malloc.c	21 May 2007 16:12:53 -0000	1.180
+++ libc/malloc/malloc.c	2 Oct 2007 03:52:03 -0000	1.181
@@ -3503,6 +3503,10 @@ mremap_chunk(p, new_size) mchunkptr p; s
   /* Note the extra SIZE_SZ overhead as in mmap_chunk(). */
   new_size = (new_size + offset + SIZE_SZ + page_mask) & ~page_mask;
 
+  /* No need to remap if the number of pages does not change.  */
+  if (size + offset == new_size)
+    return p;
+
   cp = (char *)mremap((char *)p - offset, size + offset, new_size,
                       MREMAP_MAYMOVE);