From 05acb550beba9116749808a5410ea33baf99aed0 Mon Sep 17 00:00:00 2001 From: fvdl Date: Tue, 3 Mar 1998 13:38:32 +0000 Subject: [PATCH] Only free cookies on error when they were actually allocated by the readdir vop. --- sys/nfs/nfs_subs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index b42758fb3d04..9862feedddfd 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_subs.c,v 1.56 1998/03/01 02:24:28 fvdl Exp $ */ +/* $NetBSD: nfs_subs.c,v 1.57 1998/03/03 13:38:32 fvdl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -1732,7 +1732,7 @@ nfs_cookieheuristic(vp, flagp, p, cred) struct iovec aiov; caddr_t buf, cp; struct dirent *dp; - off_t *cookies, *cop; + off_t *cookies = NULL, *cop; int error, eof, nc, len; MALLOC(buf, caddr_t, NFS_DIRFRAGSIZ, M_TEMP, M_WAITOK); @@ -1752,7 +1752,8 @@ nfs_cookieheuristic(vp, flagp, p, cred) len = NFS_DIRFRAGSIZ - auio.uio_resid; if (error || len == 0) { FREE(buf, M_TEMP); - FREE(cookies, M_TEMP); + if (cookies) + FREE(cookies, M_TEMP); return; }