From owner-freebsd-hackers Fri Sep 19 02:09:18 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id CAA27112 for hackers-outgoing; Fri, 19 Sep 1997 02:09:18 -0700 (PDT) Received: from freebie.lemis.com (gregl1.lnk.telstra.net [139.130.136.133]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id CAA27101 for ; Fri, 19 Sep 1997 02:09:11 -0700 (PDT) Received: (from grog@localhost) by freebie.lemis.com (8.8.7/8.8.5) id SAA01063; Fri, 19 Sep 1997 18:38:57 +0930 (CST) Message-ID: <19970919183857.13258@lemis.com> Date: Fri, 19 Sep 1997 18:38:57 +0930 From: Greg Lehey To: Graham Wheeler Cc: Terry Lambert , hackers@FreeBSD.ORG Subject: Re: Bug in malloc/free (was: Memory leak in getservbyXXX?) References: <199709182114.OAA13613@usr03.primenet.com> <199709190815.KAA01865@cdsec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.81e In-Reply-To: <199709190815.KAA01865@cdsec.com>; from Graham Wheeler on Fri, Sep 19, 1997 at 10:15:05AM +0200 Organisation: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8250 Fax: +61-8-8388-8250 Mobile: +61-41-739-7062 WWW-Home-Page: http://www.lemis.com/~grog Fight-Spam-Now: http://www.cauce.org Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Fri, Sep 19, 1997 at 10:15:05AM +0200, Graham Wheeler wrote: >> >> How about: >> >> heap_ptr p = malloc( 20); >> heap_ptr q, r; >> free(p); >> q = malloc(10) >> r = malloc( 10); >> free(p); >> >> ? 8-). > > Well, in this case q is typically equal to p. So the call to free(p) is > not a heap error (even though it is logically an error). > Would one call this a `Godel error'? ;-) Would alloca help, possibly? It allocates memory on the stack. Greg