diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-07-10 17:00:56 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-07-10 17:00:56 +0000 |
commit | 7bde46c2c7a9e01fc31343a95ebf18ba9130837c (patch) | |
tree | c3573cb9fde098059773f9234d4223aa98fa2a8e /sys/kern | |
parent | 67b0272f789cb5fe403568e2f3b334fa361ed236 (diff) |
Don't release a FILE that wan't allocated. Found by benno@
ok matthew@ benno@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 530d29baf78..c6462898d5e 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.185 2012/07/08 10:55:10 guenther Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.186 2012/07/10 17:00:55 guenther Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -856,8 +856,10 @@ doopenat(struct proc *p, int fd, const char *path, int oflags, mode_t mode, struct nameidata nd; fdplock(fdp); - if ((error = falloc(p, &fp, &indx)) != 0) - goto out; + if ((error = falloc(p, &fp, &indx)) != 0) { + fdpunlock(fdp); + return (error); + } flags = FFLAGS(oflags); if (flags & O_CLOEXEC) fdp->fd_ofileflags[indx] |= UF_EXCLOSE; |