Date: Thu, 19 Jun 1997 20:53:46 -0500 (EST) From: John Fieber <jfieber@indiana.edu> To: brian@awfulhak.org, brian@utell.co.uk Cc: jmz@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: realloc() quirk (was: Re: xperfmon++ problem (again)) Message-ID: <Pine.BSF.3.96.970619204118.313A-100000@fallout.campusview.indiana.edu> In-Reply-To: <199706191725.SAA00390@utell.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 Jun 1997, Brian Somers wrote: [Way to many quotes to get straight, so I won't even try.] > >>>> > Sorry. I was doing this from memory. The message was > >>>> > > >>>> > Error: Cannot perform realloc > >>>> > >>>> Well, i was checking all ``Cannot'' messages in the source, and none > >>>> didn't come close to what you've mentioned. [snip] > >>> [pozzo:/usr/home/mefoster] strings /usr/X11R6/lib/libXt.so.6.0 | grep > >>> perform > >>> Cannot perform %s [snip] > >> Ouch. I just built XFree86-3.3, and I'm now getting this from knews. > >> I rebuilt knews too - no change. > >> > >> It happens just after I press the post key !!!!!! [snip] > > Well, xc/lib/Xt/Alloc.c does the realloc (in function XtRealloc). > > I changed the diagnostic so that it says how much we're allocating, > > and it comes out as zero ! Ah ha ! [snip] > > Now this is *really* bad news AFAIK. X provides the following in > > FreeBSD.cf: > > #define Malloc0ReturnsNull NO [snip] > FWIW, this is the patch - it solves my knews problem, but isn't > *really* the right answer :| Copy it to > /usr/ports/x11/XFree86/patches/patch-af, and just "make". The problem is that malloc(0) and realloc(ptr, 0) behave differently but X assumes they behave the same. This was fixed recently in -current but phk has not (that I noticed) committed it to RELENG_2_2. However, I grabbed malloc.c from -current and re-built my 2.2.1 libc and both knews and xperfmon++ work fine. I think this is a pretty important thing to get fixed in RELENG_2_2. It might even be worthwhile to make updated copies of libc available to people who can't easily upgrade or rebuild their libc. -john
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970619204118.313A-100000>