From owner-freebsd-hackers Fri Sep 19 01:24:44 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id BAA24590 for hackers-outgoing; Fri, 19 Sep 1997 01:24:44 -0700 (PDT) Received: from citadel.cdsec.com (citadel.cdsec.com [192.96.22.18]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id BAA24584 for ; Fri, 19 Sep 1997 01:24:35 -0700 (PDT) Received: (from nobody@localhost) by citadel.cdsec.com (8.8.5/8.6.9) id KAA23703; Fri, 19 Sep 1997 10:29:44 +0200 (SAT) Received: by citadel via recvmail id 23701; Fri Sep 19 10:29:19 1997 by gram.cdsec.com (8.8.5/8.8.5) id KAA01865; Fri, 19 Sep 1997 10:15:06 +0200 (SAT) From: Graham Wheeler Message-Id: <199709190815.KAA01865@cdsec.com> Subject: Re: Bug in malloc/free (was: Memory leak in getservbyXXX?) To: tlambert@primenet.com (Terry Lambert) Date: Fri, 19 Sep 1997 10:15:05 +0200 (SAT) Cc: hackers@freebsd.org In-Reply-To: <199709182114.OAA13613@usr03.primenet.com> from "Terry Lambert" at Sep 18, 97 09:14:40 pm X-Mailer: ELM [version 2.4 PL25-h4.1] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > 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'? ;-) If you add a line afterwards of the form `free(q);', then of course this added line is detected: Bad call to free from file gwtest.c, line 33 Possibly freed before at gwtest.c, line 32, size 10 -- Dr Graham Wheeler E-mail: gram@cdsec.com Citadel Data Security Phone: +27(21)23-6065/6/7 Internet/Intranet Network Specialists Mobile: +27(83)-253-9864 Firewalls/Virtual Private Networks Fax: +27(21)24-3656 Data Security Products WWW: http://www.cdsec.com/