summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-11-10 09:34:40 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-11-10 09:34:40 +0000
commit36dbbaa79a4e5abb5a25b89f1f8404ea14a79057 (patch)
tree20013f3b177bc1a30331f363b986b3eb047f3009 /sys
parent53395fe3fcabd4e1e5ef46c8771755a5fce9c71a (diff)
Fix an mbuf leak in an error path. OK brad@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_tun.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index ee1094196db..f10e7b4fb13 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.80 2006/11/01 03:37:24 tedu Exp $ */
+/* $OpenBSD: if_tun.c,v 1.81 2006/11/10 09:34:39 claudio Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -820,7 +820,7 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
if (uio->uio_resid >= MINCLSIZE) {
MCLGET(m, M_DONTWAIT);
if (!(m->m_flags & M_EXT)) {
- m_freem(m);
+ m_free(m);
return (ENOBUFS);
}
mlen = MCLBYTES;
@@ -852,6 +852,7 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
MCLGET(m, M_DONTWAIT);
if (!(m->m_flags & M_EXT)) {
error = ENOBUFS;
+ m_free(m);
break;
}
mlen = MCLBYTES;