From owner-svn-src-head@FreeBSD.ORG Mon Sep 24 02:35:04 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 C82A8106564A; Mon, 24 Sep 2012 02:35:04 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 82C6E8FC08; Mon, 24 Sep 2012 02:35:04 +0000 (UTC) Received: by pbbrp8 with SMTP id rp8so2114928pbb.13 for ; Sun, 23 Sep 2012 19:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=MLQeSu3ljTUYNquewDlVtBGTONbtRH/XlKJTgShiZek=; b=JP48silRoH/0yXb1gWTk9I7pD0bIfCcqSsLI60fy0c9KJiIdGnERJIxOs63C3KCbNw xyam/d4pd+UQhOHrPaPoQmJykQ0mt3Xu+X3ZFuH3m4lqxXaAEChiv3ak6d4wB3lPRYiq 7gbdEBzR9XiaXVgwYRIAjIyFpyNKuOqSq049cazUSqnMqna6Btfv6sxjkK6RR57hfuA6 Ti7AYiOX0UB2q7pW4jhM/zHsKKTVi/tjSL3ZZrNw+o2kuN8ctiQd0ZIe39ZJL34GtsUw /QzxclHBlrlCnUNifqXqlKeKJVcQA+VE+glLg5l1bWBPLH7Ex2+/vMU5OzshqlnZfYZd 3yRg== Received: by 10.66.76.130 with SMTP id k2mr29164718paw.19.1348454104129; Sun, 23 Sep 2012 19:35:04 -0700 (PDT) Received: from [10.173.174.42] (mobile-166-147-095-147.mycingular.net. [166.147.95.147]) by mx.google.com with ESMTPS id pw9sm8857806pbb.42.2012.09.23.19.35.02 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 19:35:03 -0700 (PDT) References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> <505FC00B.5020204@FreeBSD.org> In-Reply-To: <505FC00B.5020204@FreeBSD.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Message-Id: <4ACBE05F-84F8-4870-B17B-6F670E4056C8@gmail.com> X-Mailer: iPhone Mail (9B206) From: Garrett Cooper Date: Sun, 23 Sep 2012 19:34:58 -0700 To: Kevin Lo Cc: Konstantin Belousov , "svn-src-head@FreeBSD.org" , "svn-src-all@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 02:35:05 -0000 Sent from my iPhone On Sep 23, 2012, at 7:06 PM, Kevin Lo wrote: > 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; Yeah -- that would be good. Thanks, -Garrett