summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-06-07 01:40:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-06-07 01:40:02 +0000
commit984a7d278a4d521eefd6f5acbb8ac8b4e7c2c4d8 (patch)
tree7eaf217fb1133d2e37682abff2d0ba86c9065855
parent39cb59b96dd74c5d874ef76815cf3bcb47b29902 (diff)
do not leak file descriptors if copyout() fails
-rw-r--r--sys/kern/uipc_syscalls.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index ffc0ee9fa7a..cff7ebce68b 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.20 1999/06/07 01:38:44 deraadt Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.21 1999/06/07 01:40:01 deraadt Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -324,7 +324,8 @@ sys_socketpair(p, v, retval)
}
error = copyout((caddr_t)sv, (caddr_t)SCARG(uap, rsv),
2 * sizeof (int));
- return (error);
+ if (error == 0)
+ return (error);
free4:
ffree(fp2);
fdp->fd_ofiles[sv[1]] = NULL;