> Masao Uebayashi wrote on Wed, Jun 24, 2015 at 12:16:35PM +0900: > > > ls(1) omits fts_close(3) after fts_open(3), resulting in an FD leak. > > Found by Valgrind. > > As far as i can see, the code is correct, there doesn't seem to be > a leak.
There is an ABI misuse; which creates what is a leak-on-the-way-to-exit > The function traverse() is static and only called at the > very end of ls_main(). The function ls_main() is only called at > the very end of main(), file main.c. So your patch would close > the file descriptor right before exit. And free memory, too. I have ok'd his change, because it is not worse. Really better if people to clarify discoveries of "it is a leak!" seperately from the class of "this is a momentary leak just before exit". Such a small shortcut will reduce the converstation..
