Avoid freeing NULL pointer in case of an error.

This commit is contained in:
Pawel Jakub Dawidek 2007-04-29 23:08:24 +00:00
parent a5fbf7ac1f
commit 2c965e1956
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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;