From owner-freebsd-hackers Thu Aug 20 13:03:21 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA13606 for freebsd-hackers-outgoing; Thu, 20 Aug 1998 13:03:21 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id NAA13584 for ; Thu, 20 Aug 1998 13:03:17 -0700 (PDT) (envelope-from imp@village.org) Received: from harmony [10.0.0.6] by rover.village.org with esmtp (Exim 1.71 #1) id 0z9aum-0002x6-00; Thu, 20 Aug 1998 14:02:32 -0600 Received: from harmony.village.org (localhost [127.0.0.1]) by harmony.village.org (8.8.8/8.8.3) with ESMTP id OAA23791; Thu, 20 Aug 1998 14:03:08 -0600 (MDT) Message-Id: <199808202003.OAA23791@harmony.village.org> To: Nate Williams Subject: Re: Realloc fix for review Cc: hackers@FreeBSD.ORG In-reply-to: Your message of "Thu, 20 Aug 1998 13:49:38 MDT." <199808201949.NAA08010@mt.sri.com> References: <199808201949.NAA08010@mt.sri.com> <199808201619.KAA20970@harmony.village.org> Date: Thu, 20 Aug 1998 14:03:08 -0600 From: Warner Losh Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <199808201949.NAA08010@mt.sri.com> Nate Williams writes: : In short, I think it's the *wrong* thing to do, and has too many worse : side-effects than the original code. No nate. You've read my patch wrong. If the realloc fails, it reutnrs NULL. When it returns NULL, the right thing to do is to free the old pointer. However, only in cases where the old code was a = realloc(a, src) but not when the old code was b = realloc(a,src) since the first destroys A in the failure case. At that point, the memory is leaked. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message