NetBSD-Bugs archive

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

Re: kern/38374: fdfile leak



> Maybe fd_lastfile is not being updated correctly?

fd_lastfile shrinks without freeing fdfile_t.

YAMAMOTO Takashi

Index: kern_descrip.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_descrip.c,v
retrieving revision 1.174
diff -u -p -r1.174 kern_descrip.c
--- kern_descrip.c      27 Mar 2008 18:33:39 -0000      1.174
+++ kern_descrip.c      7 Apr 2008 04:56:22 -0000
@@ -1475,7 +1475,7 @@ fd_free(void)
        /*
         * Close any files that the process holds open.
         */
-       for (fd = 0, lastfd = fdp->fd_lastfile; fd <= lastfd; fd++) {
+       for (fd = 0, lastfd = fdp->fd_nfiles - 1; fd <= lastfd; fd++) {
                ff = fdp->fd_ofiles[fd];
                KASSERT(fd >= NDFDFILE ||
                    ff == (fdfile_t *)fdp->fd_dfdfile[fd]);


Home | Main Index | Thread Index | Old Index