ls(1) omits fts_close(3) after fts_open(3), resulting in an FD leak.
Found by Valgrind.

Index: bin/ls/ls.c
===================================================================
RCS file: /cvs/src/bin/ls/ls.c,v
retrieving revision 1.40
diff -u -p -r1.40 ls.c
--- bin/ls/ls.c 18 Apr 2015 18:28:36 -0000      1.40
+++ bin/ls/ls.c 24 Jun 2015 03:10:47 -0000
@@ -403,6 +403,8 @@ traverse(int argc, char *argv[], int opt
                }
        if (errno)
                err(1, "fts_read");
+
+       fts_close(ftsp);
 }
 
 /*

Reply via email to