Author: markj
Date: Mon Feb 22 20:18:10 2016
New Revision: 295897
URL: https://svnweb.freebsd.org/changeset/base/295897

Log:
  MFC r295574:
  Clear the cookie pointer on error in tmpfs_readdir().
  
  Approved by:  re (glebius)

Modified:
  stable/10/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- stable/10/sys/fs/tmpfs/tmpfs_vnops.c        Mon Feb 22 19:17:59 2016        
(r295896)
+++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c        Mon Feb 22 20:18:10 2016        
(r295897)
@@ -1187,8 +1187,11 @@ tmpfs_readdir(struct vop_readdir_args *v
        if (error == EJUSTRETURN)
                error = (uio->uio_resid != startresid) ? 0 : EINVAL;
 
-       if (error != 0 && cookies != NULL)
+       if (error != 0 && cookies != NULL && ncookies != NULL) {
                free(*cookies, M_TEMP);
+               *cookies = NULL;
+               *ncookies = 0;
+       }
 
        if (eofflag != NULL)
                *eofflag =
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to