summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2012-04-14 09:07:43 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2012-04-14 09:07:43 +0000
commitb24bb61092bfc78fc1d60744dd936d4f10e3de57 (patch)
treeeda70fafb78fc7a7e435c824270bdf973400418e /sys/kern
parentdd518ce22c523dc768eda5c8af3c6dd933fba391 (diff)
Free tmp buffer in case the cluster allocation failed. Found by David Hill.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_usrreq.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 7f3bcbf0ca7..dbab77cd65e 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.62 2012/04/14 08:47:27 guenther Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.63 2012/04/14 09:07:42 claudio Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -787,8 +787,10 @@ morespace:
/* allocate a cluster and try again */
MCLGET(control, M_WAIT);
- if ((control->m_flags & M_EXT) == 0)
+ if ((control->m_flags & M_EXT) == 0) {
+ free(tmp, M_TEMP);
return (ENOBUFS); /* allocation failed */
+ }
/* copy the data back into the cluster */
cm = mtod(control, struct cmsghdr *);