From 8c646bef996ac776439673158c28a92d047dd03a Mon Sep 17 00:00:00 2001 From: markj Date: Mon, 22 Feb 2016 20:18:10 +0000 Subject: MFC r295574: Clear the cookie pointer on error in tmpfs_readdir(). Approved by: re (glebius) --- sys/fs/tmpfs/tmpfs_vnops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/fs/tmpfs/tmpfs_vnops.c') diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 885f84c..f01c8be 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -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 = -- cgit v1.1