From 2c965e1956bf129d7f6de3c8dd76389af878cf8d Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sun, 29 Apr 2007 23:08:24 +0000 Subject: [PATCH] Avoid freeing NULL pointer in case of an error. --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 2 +- sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index e50db3b05883..58c9d4bdf848 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -1929,7 +1929,7 @@ zfs_readdir(vnode_t *vp, uio_t *uio, cred_t *cr, int *eofp, int *ncookies, u_lon uio->uio_loffset = offset; ZFS_EXIT(zfsvfs); - if (error != 0) { + if (error != 0 && *cookies != NULL) { free(*cookies, M_TEMP); *cookies = NULL; *ncookies = 0; diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index e50db3b05883..58c9d4bdf848 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -1929,7 +1929,7 @@ zfs_readdir(vnode_t *vp, uio_t *uio, cred_t *cr, int *eofp, int *ncookies, u_lon uio->uio_loffset = offset; ZFS_EXIT(zfsvfs); - if (error != 0) { + if (error != 0 && *cookies != NULL) { free(*cookies, M_TEMP); *cookies = NULL; *ncookies = 0;