Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2013 11:11:49 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Xin LI <delphij@gmail.com>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Eitan Adler <eadler@freebsd.org>
Subject:   Re: svn commit: r245494 - head/bin/pwait
Message-ID:  <201301161111.49580.jhb@freebsd.org>
In-Reply-To: <CAGMYy3smQv4-3oxZBFC1EkJQr%2B=3n08z=tBr_Lt58zxfTcYB6Q@mail.gmail.com>
References:  <201301160503.r0G53qie087155@svn.freebsd.org> <CAGMYy3smQv4-3oxZBFC1EkJQr%2B=3n08z=tBr_Lt58zxfTcYB6Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, January 16, 2013 1:49:40 am Xin LI wrote:
> This doesn't seem right -- you should never release memory before exit,
> especially for memory allocated in main(), unless this "main" is intended
> for different purpose like a monolithic shell that wants to avoid exec().
>  Note that pwait(1) have multiple exit points I don't think it's practical.
> 
> Would you mind if I commit this changeset instead?  I have the return ->
> exit change in my queue long ago but only noticed it today...

I think the free shouldn't be there as well, but I think requiring an exit() 
instead of return to "fix" it is bogus as well.  The static analyzer is just
broken in this case.  main() is special and returns from it should be
treated like exit() and not cause false warnings about memory leaks.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301161111.49580.jhb>