[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
exit()/return() impacts valgrind leak checker
From: |
Pádraig Brady |
Subject: |
exit()/return() impacts valgrind leak checker |
Date: |
Fri, 04 Sep 2015 14:43:53 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 09/09/14 10:50, Pádraig Brady wrote:
> On 09/09/2014 04:55 AM, Paul Eggert wrote:
>> I noticed other problems that are at least somewhat related to the
>> recent coreutils multi-binary executable changes, and fixed some of
>> these problems with the attached patches.
>>
>> Subject: [PATCH 3/4] maint: prefer 'return status;' to 'exit (status);' in
>> 'main'
>> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.23-19-g8defcee
>
> simpler so +1
> There were a couple of syntax-check errors with this, fixed in
> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.23-21-g20f46a2
Another caveat with using return() instead of exit()
is that valgrind will now report mem allocated in main()
as "definitely lost" as noted at http://stackoverflow.com/q/31622764/4421
That precludes using this to auto flag mem leaks:
valgrind --leak-check=full --error-exitcode=1 --errors-for-leak-kinds=definite
The attached patch explicitly free()s these allocations, in dev builds.
cheers,
Pádraig.
avoid-valgrind-leak-warnings.patch
Description: Text Data
- exit()/return() impacts valgrind leak checker,
Pádraig Brady <=