Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 1997 14:09:10 +1000
From:      David Dawes <dawes@rf900.physics.usyd.edu.au>
To:        Brian Somers <brian@awfulhak.org>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: xperfmon++ problem (again)
Message-ID:  <19970620140910.56164@rf900.physics.usyd.edu.au>
In-Reply-To: <199706200217.DAA29697@awfulhak.demon.co.uk>; from Brian Somers on Fri, Jun 20, 1997 at 03:17:12AM %2B0100
References:  <19970620111839.40700@rf900.physics.usyd.edu.au> <199706200217.DAA29697@awfulhak.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jun 20, 1997 at 03:17:12AM +0100, Brian Somers wrote:
>[.....]
>> >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 right answer in my opinion is to change the definition of
>> Malloc0ReturnsNULL back to YES in FreeBSD.cf.  That won't cause
>> any problems for the case where malloc(0) returns a non-NULL pointer.
>
>Are you sure that when Malloc0ReturnsNULL is set to YES, pointer
>values returned from malloc(0) are freed ?  Maybe there's some nasty
>code that says something like
>
>#if !Malloc0ReturnsNUL        /* or whatever */
>if (!mallocSize)
>  free(ptr);
>#endif
>
>although I'd hope not !

In the core X11 code, the behaviour of free is not affected by the setting
of Malloc0ReturnsNULL.  For example, XtFree() is:

#define Xfree(ptr) free(ptr)

void XtFree(ptr)
    char *ptr;
{
    if (ptr != NULL) Xfree(ptr);
}

David



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