svn commit: r240850 - head/lib/libstand
Konstantin Belousov
kostikbel at gmail.com
Mon Sep 24 04:28:15 UTC 2012
On Mon, Sep 24, 2012 at 10:06:03AM +0800, Kevin Lo wrote:
> On 2012/09/24 03:27, Garrett Cooper wrote:
> > On Sun, Sep 23, 2012 at 3:52 AM, Konstantin Belousov
> > <kostikbel at gmail.com> 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.
It is code bloat.
> I have no problem changing it back, but there are two other places where
> the same comment could apply.
Yes, this is good to apply as well.
>
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20120924/1ca2fefe/attachment.pgp
More information about the svn-src-head
mailing list