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 your patch to use it and push in your name. cheers, Pádraig.
