Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Aug 1998 20:22:34 +0200
From:      Eivind Eklund <eivind@yes.no>
To:        Warner Losh <imp@village.org>, hackers@FreeBSD.ORG
Subject:   Re: Realloc fix for review
Message-ID:  <19980820202234.27107@follo.net>
In-Reply-To: <199808201619.KAA20970@harmony.village.org>; from Warner Losh on Thu, Aug 20, 1998 at 10:19:42AM -0600
References:  <199808201619.KAA20970@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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