coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] maint: fix a memory leak in df


From: Pádraig Brady
Subject: Re: [PATCH] maint: fix a memory leak in df
Date: Thu, 11 Jul 2013 13:53:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 07/09/2013 02:53 AM, Pádraig Brady wrote:
> On 07/08/2013 03:53 PM, Anton Ovchinnikov wrote:
>> Valgrind shows some memory leaks while launching 'df' without arguments:
>>
>> ==8809== LEAK SUMMARY:
>> ==8809==    definitely lost: 48 bytes in 1 blocks
>> ==8809==    indirectly lost: 16 bytes in 3 blocks
>> ...
>>
>> If I launch 'df -a' valgrind doesn't detect any 'lost' memory.
>> As far as I understand, this is not the case for using IF_LINT macro,
>> as it's impossible to predict the size of lost memory.
>> I believe the following patch eliminates the leak.
> 
> It looks good thanks.
> 
>> One more thing: the inserted code looks similar to the fragment at
>> gnulib/lib/mountlist.c:964. What about moving this fragment to
>> stand-alone function (free_mount_entry(struct mount_entry *me))? It
>> implies exposing this function in mountlist.h.
> 
> Yes it makes sense to expose such a function in gnulib,
> as theoretically one could be calling read_file_system_list()
> from a long lived process.
> 
> I'll push such a patch to gnulib and will adjust

http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=41d1b6c4

> your patch to use it and push in your name.

Attached.  Note it's updated to free _all_ discarded mount items,
not just those being replaced.

thanks,
Pádraig.

Attachment: df-memfree.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]