Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Jan 1996 23:13:39 +0100
From:      Poul-Henning Kamp <phk@critter.tfs.com>
To:        Lars Fredriksen <fredriks@mcs.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: malloc bug in current? 
Message-ID:  <1267.820793619@critter.tfs.com>
In-Reply-To: Your message of "Thu, 04 Jan 1996 14:41:36 CST." <199601042041.OAA29400@fredriks.pr.mcs.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Hi,
> 	Pax kept blowing up on me in free() so I started looking at tit a bit.
> It looks like there is a slight bug in malloc.c. 

Hmm, I guess I'll have to look at it.  It was meant to be that there would
always be at least one entry behind the last used one, to avoid this 
comparison, so I guess I have missed one place.

Thanks!

Poul-Henning

> 
> -----------------------------------------------------------------------------
--
> *** malloc.c.orig	Thu Jan  4 08:45:03 1996
> --- malloc.c	Thu Jan  4 08:45:06 1996
> ***************
> *** 957,963 ****
>   
>       /* Count how many pages and mark them free at the same time */
>       page_dir[index] = MALLOC_FREE;
> !     for (i = 1; page_dir[index+i] == MALLOC_FOLLOW; i++)
>   	page_dir[index + i] = MALLOC_FREE;
>   
>       l = i << malloc_pageshift;
> --- 957,963 ----
>   
>       /* Count how many pages and mark them free at the same time */
>       page_dir[index] = MALLOC_FREE;
> !     for (i = 1; (index < last_index) && (page_dir[index+i] == MALLOC_FOLLOW
); i++)
>   	page_dir[index + i] = MALLOC_FREE;
>   
>       l = i << malloc_pageshift;
> -----------------------------------------------------------------------------
--
> 
> The problem was( I think) that index+i went past last_index which caused a 
> SIGSEGV. With the above fix my backups now works again. :-)
> 
> Lars

--
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
Future will arrive by its own means, progress not so.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1267.820793619>