From owner-svn-src-head@FreeBSD.ORG Wed Jan 16 18:43:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6F8BC8F6; Wed, 16 Jan 2013 18:43:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 4BA81213; Wed, 16 Jan 2013 18:43:04 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 97F39B91A; Wed, 16 Jan 2013 13:43:03 -0500 (EST) From: John Baldwin To: Xin LI Subject: Re: svn commit: r245494 - head/bin/pwait Date: Wed, 16 Jan 2013 11:11:49 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201301160503.r0G53qie087155@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201301161111.49580.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 16 Jan 2013 13:43:03 -0500 (EST) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Wed, 16 Jan 2013 18:43:04 -0000 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