From owner-freebsd-hackers Thu Aug 20 11:23:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA26142 for freebsd-hackers-outgoing; Thu, 20 Aug 1998 11:23:31 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ns1.yes.no (ns1.yes.no [195.119.24.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA26122 for ; Thu, 20 Aug 1998 11:23:26 -0700 (PDT) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.8.7/8.8.7) with ESMTP id SAA11846; Thu, 20 Aug 1998 18:22:34 GMT Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id UAA02576; Thu, 20 Aug 1998 20:22:34 +0200 (MET DST) Message-ID: <19980820202234.27107@follo.net> Date: Thu, 20 Aug 1998 20:22:34 +0200 From: Eivind Eklund To: Warner Losh , hackers@FreeBSD.ORG Subject: Re: Realloc fix for review References: <199808201619.KAA20970@harmony.village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1i In-Reply-To: <199808201619.KAA20970@harmony.village.org>; from Warner Losh on Thu, Aug 20, 1998 at 10:19:42AM -0600 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Aug 20, 1998 at 10:19:42AM -0600, Warner Losh wrote: > > Recently, OpenBSD went through their source tree and fixed all > instances of > a = realloc(a, size); > with > na = realloc(a, size); > if (!na) > free(a); > a = na; This change seems pointless. If the programmer is that thoughtless, I'd believe he assume a to be valid later, too, and thus will core-dump pretty soon. If other changes are done in the vicinity, fine, but replacing the bogus code with a more well-thought-out function means that we loose the indicator that the area is bogus. IMO, bad to do without also loosing the bogosity. Apart from that, your solution was a nice solution to what I believe to be the wrong problem :-) Eivind. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message