[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] uptime: fix a memory leak after printing results
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] uptime: fix a memory leak after printing results |
Date: |
Mon, 08 Jul 2013 09:15:04 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 07/07/2013 10:01 PM, Anton Ovchinnikov wrote:
> Thank you for explanations!
>
>> For such cases we usually do:
>>
>> IF_LINT (free (utmp_buf));
>>
>> or for larger blocks:
>>
>> #ifdef lint
>> ....
>> #endif
>
> Just to be sure that I understand all the stuff I about lint and
> IF_LINT correctly:
> To prevent 'valgrind' from complaining we use IF_LINT macro during dev
> builds, so the code inside IF_LINT actually works. But at the same
> time we realize that it's redundant to free() that kind of buffer, so
> end users use the binary which was compiled without the corresponding
> macro, hence there's no generated code for free(utmp_buf) in that
> binary. Is that correct?
Exactly.