svn commit: r245494 - head/bin/pwait
Garrett Cooper
yanegomi at gmail.com
Wed Jan 16 18:17:37 UTC 2013
On Jan 16, 2013, at 10:11 AM, Xin Li <delphij at delphij.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> On 01/16/13 09:47, Eitan Adler wrote:
>> On 16 January 2013 01:49, Xin LI <delphij at gmail.com> 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.
>>
>> ...
>>
>> There have been multiple conversations about this: on hackers, on
>> the commit lists, and on the clang analyzer lists.
>>
>> 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.
>
> Yes I did. Using exit(3) tells clang that this is the final exit and
> thus eliminates the warning.
>
> 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 prevents bugs from occurring in other OSes (like windows when you use atexit and posix-compliant signal handlers).
Thanks,
-Garrett
More information about the svn-src-head
mailing list