public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix malloc_consolidate
@ 2006-10-17 12:21 Jakub Jelinek
  2006-10-18 19:08 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2006-10-17 12:21 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

The last malloc_consolidate change causes crashes.  The do while loop
has fb++ != maxfb condition, so fb in the last iteration is equal to maxfb.
Thus, maxfb can't be pointer to the end of the array, but must point to the
last element in it.

2006-10-17  Jakub Jelinek  <jakub@redhat.com>

	[BZ #3313]
	* malloc/malloc.c (malloc_consolidate): Set maxfb to address of last
	fastbin rather than end of fastbin array.

--- libc/malloc/malloc.c.jj	2006-10-17 10:29:08.000000000 +0200
+++ libc/malloc/malloc.c	2006-10-17 14:09:56.000000000 +0200
@@ -4699,7 +4699,7 @@ static void malloc_consolidate(av) mstat
        search all bins all the time.  */
     maxfb = &(av->fastbins[fastbin_index(get_max_fast ())]);
 #else
-    maxfb = &(av->fastbins[NFASTBINS]);
+    maxfb = &(av->fastbins[NFASTBINS - 1]);
 #endif
     fb = &(av->fastbins[0]);
     do {

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix malloc_consolidate
  2006-10-17 12:21 [PATCH] Fix malloc_consolidate Jakub Jelinek
@ 2006-10-18 19:08 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2006-10-18 19:08 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers

Applied.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-18 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-17 12:21 [PATCH] Fix malloc_consolidate Jakub Jelinek
2006-10-18 19:08 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).