From owner-freebsd-hackers Thu Aug 20 20:09:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA20752 for freebsd-hackers-outgoing; Thu, 20 Aug 1998 20:09:12 -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 UAA20743 for ; Thu, 20 Aug 1998 20:09:10 -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 0z9hYq-0003Bd-00; Thu, 20 Aug 1998 21:08:20 -0600 Received: from harmony.village.org (localhost [127.0.0.1]) by harmony.village.org (8.8.8/8.8.3) with ESMTP id VAA26640; Thu, 20 Aug 1998 21:09:00 -0600 (MDT) Message-Id: <199808210309.VAA26640@harmony.village.org> To: Brian Somers Subject: Re: Realloc fix for review Cc: Archie Cobbs , nate@mt.sri.com (Nate Williams), hackers@FreeBSD.ORG In-reply-to: Your message of "Fri, 21 Aug 1998 02:07:35 BST." <199808210107.CAA13727@awfulhak.org> References: <199808210107.CAA13727@awfulhak.org> Date: Thu, 20 Aug 1998 21:08:59 -0600 From: Warner Losh Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <199808210107.CAA13727@awfulhak.org> Brian Somers writes: : AFAIK not all free() implementations ignore a NULL pointer (although : FreeBSD's does). But then, not all realloc() implementations allow a : NULL either (FreeBSD's does) :-/ free(NULL); is required to be valid by tha ANSI standard. I don't know about the realloc(NULL, s); case, however. But, the frealloc, as I implemented it (rather than how I posted it) looks exactly like: #include void * frealloc(void *ptr, size_t size) { void *nptr; nptr = realloc(ptr, size); if (!nptr && ptr) free(ptr); return (nptr); } which does try to avoid calling free(NULL). Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message