From owner-freebsd-hackers Thu Jun 19 21:15:23 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA09233 for hackers-outgoing; Thu, 19 Jun 1997 21:15:23 -0700 (PDT) Received: from rf900.physics.usyd.edu.au (rf900.physics.usyd.edu.au [129.78.129.109]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA09224 for ; Thu, 19 Jun 1997 21:15:17 -0700 (PDT) Received: (from dawes@localhost) by rf900.physics.usyd.edu.au (8.8.5/8.8.2) id OAA08955; Fri, 20 Jun 1997 14:09:10 +1000 (EST) Message-ID: <19970620140910.56164@rf900.physics.usyd.edu.au> Date: Fri, 20 Jun 1997 14:09:10 +1000 From: David Dawes To: Brian Somers Cc: hackers@FreeBSD.ORG Subject: Re: xperfmon++ problem (again) References: <19970620111839.40700@rf900.physics.usyd.edu.au> <199706200217.DAA29697@awfulhak.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.69 In-Reply-To: <199706200217.DAA29697@awfulhak.demon.co.uk>; from Brian Somers on Fri, Jun 20, 1997 at 03:17:12AM +0100 Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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