From owner-svn-src-head@FreeBSD.ORG Mon Sep 24 08:47:52 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A7F4106564A; Mon, 24 Sep 2012 08:47:52 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) by mx1.freebsd.org (Postfix) with ESMTP id D71F48FC17; Mon, 24 Sep 2012 08:47:51 +0000 (UTC) Received: from [192.168.0.2] (cpc2-cmbg15-2-0-cust445.5-4.cable.virginmedia.com [86.26.13.190]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id q8O8lmMQ018429 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 24 Sep 2012 08:47:50 GMT (envelope-from theraven@FreeBSD.org) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: David Chisnall In-Reply-To: Date: Mon, 24 Sep 2012 09:47:45 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> To: Garrett Cooper X-Mailer: Apple Mail (2.1278) Cc: Konstantin Belousov , Kevin Lo , svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 08:47:52 -0000 On 23 Sep 2012, at 20:27, Garrett Cooper wrote: > +1. free(3) should silently ignore NULL parameters passed into it. Indeed. The C standard's description for free() states that: > If ptr is a null pointer, no action occurs. This means that a standards-compilant compiler is entirely at liberty to = elide these checks (not sure if GCC or LLVM does, but both have = optimisation passes that optimise based on assumptions about standard = library functions, although they may not run when compiled in a = freestanding environment). The only reasons for a NULL check before free() should be: - Sanity checking (i.e. this pointer is never meant to be NULL, assert = that it isnt) - Recursive cleanup (don't dereference this pointer to clean up its = elements if it is NULL) David=