From owner-svn-src-all@FreeBSD.ORG Wed Jan 16 18:17:37 2013 Return-Path: Delivered-To: svn-src-all@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 9A495D8C; Wed, 16 Jan 2013 18:17:37 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-da0-f46.google.com (mail-da0-f46.google.com [209.85.210.46]) by mx1.freebsd.org (Postfix) with ESMTP id 5695AFE2; Wed, 16 Jan 2013 18:17:37 +0000 (UTC) Received: by mail-da0-f46.google.com with SMTP id p5so679556dak.19 for ; Wed, 16 Jan 2013 10:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:x-mailer:from:subject:date :to; bh=lvTz44N7Xi/SHCNNs51EzDyIiLnjQ6mSw+IgBVkpIII=; b=W7ZQWlrIzr9ofgE5jmZv4RwrsbbmA71bcEjet3ZZpFMoBXJbOsbHY7KWE2/SU3LmKE RGVsUPN3ycUSWVXMvSp8TLmcWr0ukQfcWDhyGPX63g5KcAEFTB0zJonkTrWCm+tsNdZW WxWbLvx0oi7H8FSf7rjaGj9Cw9OWuQKXVNpopyYWK/YrIe8tTE7AWtgkWg4pwZSN0Sgy RxhRdij2iFAPXMTk/4vL3ElU1Svs95brJEzwAXxsJeoJLsenHYjBY6lHEWb7gKJ4KkSU c0rFjQlO/l4RGCRjFC9m/X63a0XnXsG9qeqAk6sAn3glBW5zkG0rltEN9ludDekpPsB+ 2qQQ== X-Received: by 10.66.88.198 with SMTP id bi6mr5832831pab.54.1358360251540; Wed, 16 Jan 2013 10:17:31 -0800 (PST) Received: from [10.0.14.181] (mobile-166-137-216-036.mycingular.net. [166.137.216.36]) by mx.google.com with ESMTPS id qo10sm11985075pbc.58.2013.01.16.10.17.27 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jan 2013 10:17:30 -0800 (PST) References: <201301160503.r0G53qie087155@svn.freebsd.org> <50F6ED68.50602@delphij.net> Mime-Version: 1.0 (1.0) In-Reply-To: <50F6ED68.50602@delphij.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <0928E58E-F510-47CD-957F-8C321B1210CC@gmail.com> X-Mailer: iPhone Mail (10A523) From: Garrett Cooper Subject: Re: svn commit: r245494 - head/bin/pwait Date: Wed, 16 Jan 2013 10:17:20 -0800 To: "d@delphij.net" Cc: "svn-src-head@freebsd.org" , Xin LI , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Eitan Adler X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2013 18:17:37 -0000 On Jan 16, 2013, at 10:11 AM, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 >=20 > On 01/16/13 09:47, Eitan Adler wrote: >> On 16 January 2013 01:49, 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. >>=20 >> ... >>=20 >> There have been multiple conversations about this: on hackers, on >> the commit lists, and on the clang analyzer lists. >>=20 >> I don't care much how the final code looks: with either free or >> return but please make sure that scan-build finds no warnings. >=20 > Yes I did. Using exit(3) tells clang that this is the final exit and > thus eliminates the warning. >=20 > It sounds like a bug (or arguably a feature) that clang does not > recognize return in main()s... I would consider it a bug, but it's better to use exit(3) anyhow as it p= revents bugs from occurring in other OSes (like windows when you use atexit a= nd posix-compliant signal handlers). Thanks, -Garrett=