summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_oldselect.c
diff options
context:
space:
mode:
authorfvdl <fvdl@NetBSD.org>1998-03-03 13:44:48 +0000
committerfvdl <fvdl@NetBSD.org>1998-03-03 13:44:48 +0000
commita377495cfba1cafc26985acb57ec04facf25afe2 (patch)
tree0309acf28ac1e3e8882ad084126e62bce8d472a0 /sys/compat/linux/common/linux_oldselect.c
parent05acb550beba9116749808a5410ea33baf99aed0 (diff)
Only free cookiebuf when sure that the vop actually allocated it.
Diffstat (limited to 'sys/compat/linux/common/linux_oldselect.c')
-rw-r--r--sys/compat/linux/common/linux_oldselect.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/compat/linux/common/linux_oldselect.c b/sys/compat/linux/common/linux_oldselect.c
index c71b4e0bc40..c9aaca962b4 100644
--- a/sys/compat/linux/common/linux_oldselect.c
+++ b/sys/compat/linux/common/linux_oldselect.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_oldselect.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
+/* $NetBSD: linux_oldselect.c,v 1.40 1998/03/03 13:44:48 fvdl Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@@ -788,7 +788,7 @@ linux_sys_getdents(p, v, retval)
off_t off; /* true file offset */
int buflen, error, eofflag, nbytes, oldcall;
struct vattr va;
- off_t *cookiebuf, *cookie;
+ off_t *cookiebuf = NULL, *cookie;
int ncookies;
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
@@ -904,7 +904,8 @@ eof:
*retval = nbytes - resid;
out:
VOP_UNLOCK(vp, 0);
- free(cookiebuf, M_TEMP);
+ if (cookiebuf)
+ free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
return error;
}