Only free cookiebuf when sure that the vop actually allocated it.

This commit is contained in:
fvdl 1998-03-03 13:44:48 +00:00
parent 05acb550be
commit a377495cfb
19 changed files with 79 additions and 59 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibcs2_misc.c,v 1.33 1998/03/01 02:22:58 fvdl Exp $ */
/* $NetBSD: ibcs2_misc.c,v 1.34 1998/03/03 13:47:48 fvdl Exp $ */
/*
* Copyright (c) 1994, 1995, 1998 Scott Bartram
@ -362,7 +362,7 @@ ibcs2_sys_getdents(p, v, retval)
struct ibcs2_dirent idb;
off_t off; /* true file offset */
int buflen, error, eofflag;
off_t *cookiebuf, *cookie;
off_t *cookiebuf = NULL, *cookie;
int ncookies;
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
@ -447,7 +447,8 @@ eof:
*retval = SCARG(uap, nbytes) - resid;
out:
VOP_UNLOCK(vp, 0);
free(cookiebuf, M_TEMP);
if (cookiebuf)
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_break.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_break.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_misc.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_misc_notalpha.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldmmap.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_oldmmap.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldolduname.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_oldolduname.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;
}

View File

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

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_olduname.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_olduname.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_pipe.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_pipe.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_misc.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_break.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_break.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_misc_notalpha.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldmmap.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_oldmmap.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldolduname.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_oldolduname.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;
}

View File

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

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_olduname.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_olduname.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_pipe.c,v 1.39 1998/03/01 02:23:03 fvdl Exp $ */
/* $NetBSD: linux_pipe.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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_misc.c,v 1.88 1998/03/01 02:22:45 fvdl Exp $ */
/* $NetBSD: sunos_misc.c,v 1.89 1998/03/03 13:46:42 fvdl Exp $ */
/*
* Copyright (c) 1992, 1993
@ -440,7 +440,7 @@ sunos_sys_getdents(p, v, retval)
struct sunos_dirent idb;
off_t off; /* true file offset */
int buflen, error, eofflag;
off_t *cookiebuf, *cookie;
off_t *cookiebuf = NULL, *cookie;
int ncookies;
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
@ -530,7 +530,8 @@ eof:
*retval = SCARG(uap, nbytes) - resid;
out:
VOP_UNLOCK(vp, 0);
free(cookiebuf, M_TEMP);
if (cookiebuf)
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_misc.c,v 1.59 1998/03/01 02:22:50 fvdl Exp $ */
/* $NetBSD: svr4_misc.c,v 1.60 1998/03/03 13:45:58 fvdl Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@ -234,7 +234,7 @@ svr4_sys_getdents64(p, v, retval)
struct svr4_dirent64 idb;
off_t off; /* true file offset */
int buflen, error, eofflag;
off_t *cookiebuf, *cookie;
off_t *cookiebuf = NULL, *cookie;
int ncookies;
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
@ -318,7 +318,8 @@ eof:
*retval = SCARG(uap, nbytes) - resid;
out:
VOP_UNLOCK(vp, 0);
free(cookiebuf, M_TEMP);
if (cookiebuf)
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
return error;
}
@ -343,7 +344,7 @@ svr4_sys_getdents(p, v, retval)
struct svr4_dirent idb;
off_t off; /* true file offset */
int buflen, error, eofflag;
off_t *cookiebuf, *cookie;
off_t *cookiebuf = NULL, *cookie;
int ncookies;
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
@ -431,7 +432,8 @@ eof:
*retval = SCARG(uap, nbytes) - resid;
out:
VOP_UNLOCK(vp, 0);
free(cookiebuf, M_TEMP);
if (cookiebuf)
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
return error;
}