From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 02:07:57 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A85F4106566B; Mon, 24 Sep 2012 02:07:57 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id 37F298FC0A; Mon, 24 Sep 2012 02:07:56 +0000 (UTC) Received: from srg.kevlo.org (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id q8O262pD003892; Mon, 24 Sep 2012 10:06:02 +0800 (CST) (envelope-from kevlo@FreeBSD.org) Message-ID: <505FC00B.5020204@FreeBSD.org> Date: Mon, 24 Sep 2012 10:06:03 +0800 From: Kevin Lo User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120829 Thunderbird/14.0 MIME-Version: 1.0 To: Garrett Cooper References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 02:07:57 -0000 On 2012/09/24 03:27, Garrett Cooper wrote: > On Sun, Sep 23, 2012 at 3:52 AM, Konstantin Belousov > wrote: >> On Sun, Sep 23, 2012 at 08:38:06AM +0000, Kevin Lo wrote: >>> Author: kevlo >>> Date: Sun Sep 23 08:38:06 2012 >>> New Revision: 240850 >>> URL: http://svn.freebsd.org/changeset/base/240850 >>> >>> Log: >>> Avoid NULL dereference >>> >>> Modified: >>> head/lib/libstand/nfs.c > ... > >> I do not see how this change is useful. libstand' Free() function handles >> NULL parameter fine, as well as all other free(3) implementations I am >> aware of. > +1. free(3) should silently ignore NULL parameters passed into it. Well, The patch is harmless. I suppose I could argue it is a safety belt against free(NULL) should be silently ignored. I have no problem changing it back, but there are two other places where the same comment could apply. Index: lib/libstand/nfs.c =================================================================== --- lib/libstand/nfs.c (revision 240879) +++ lib/libstand/nfs.c (working copy) @@ -606,10 +606,8 @@ nfs_open(const char *upath, struct open_file *f) error = 0; out: - if (newfd) - free(newfd); - if (path) - free(path); + free(newfd); + free(path); #else currfd->iodesc = desc; @@ -1256,10 +1254,8 @@ nfs_open(const char *upath, struct open_file *f) error = 0; out: - if (newfd) - free(newfd); - if (path) - free(path); + free(newfd); + free(path); #else currfd->iodesc = desc; > Thanks, > Garrett > Kevin