From owner-svn-src-head@FreeBSD.ORG Wed Jan 16 21:36:32 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 2B9DE347; Wed, 16 Jan 2013 21:36:32 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id E019BF86; Wed, 16 Jan 2013 21:36:31 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 612461E4EA; Wed, 16 Jan 2013 13:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1358372191; bh=FxUsqW0y+o66sNfGQKxJ4gPwcBLNKnNnV7iGV3CLLV8=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=3FpuSYpWS1I8Ti4/c2iDG5MQ1OKA61Vnc+BUTZyT2+yg4aK2qodl0dQHQ2rAt6WC1 QBPiUWM/Wl31d3yTSbUEzZr0QsdOB2v51YdcWeMlsmhl9vQzhWgt1J0rsJGIgr901z cCxr1UfA7V+1FjoMK7qMFDzvG2JPxcdwXIeAUA8E= Message-ID: <50F71D5E.60604@delphij.net> Date: Wed, 16 Jan 2013 13:36:30 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r245494 - head/bin/pwait References: <201301160503.r0G53qie087155@svn.freebsd.org> <201301161111.49580.jhb@freebsd.org> In-Reply-To: <201301161111.49580.jhb@freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , Eitan Adler , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Xin LI X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net 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 21:36:32 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 01/16/13 08:11, John Baldwin wrote: > 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. Well, being a horrible idea itself to redefine main() to something else and expect the module to do no harm to its caller, I think Eitan still have a valid point that it could be a bad idea to ban this in wholesale within compiler, as the C standard don't ban using return's in main(). In style(9) the examples do use exit() for main() by the way. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQ9x1eAAoJEG80Jeu8UPuzIGsH/ia5cFVA2Uo6w1tEvbbAVMUi +A580EYdQNdCFYVVGCIr6ZoCuZYsYqJdU0wT+xKjpE5qwaCfWVkESWbUGFVKUmFt F1bFZfVu1TgntopYFj5goRyUVvsEutUgh/D8khZSKn9Mnu6ijbeq2CKJi0SyhySw FcmGzp2YNk1B5BW8N8c4oRpLGvwtXPO4QBf5VAEoPU4ItY8bTukH2u09jOKaoh+7 J5eMU8KqWmxcuj6v5/8mb5iUN0oMprbdhVrpb0UpvIfM+TMQ3ISEbyJ5KeHW6dkV 5FLiu3arMe1p3k2yLrGYLB19lZfwtz3gM8QyorqAGK64uNY5oqwsA3UlIo01w48= =V4kG -----END PGP SIGNATURE-----