summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-09-29 02:40:39 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-09-29 02:40:39 +0000
commitb5b19d319d91370850135566c2bd14ab49165c1f (patch)
tree375e126ac36f5f48403a7bbf8d6f6ea910613270 /sys/dev
parentd2ca508195603f18fe6e544867e91abadd83dca4 (diff)
free the mbuf chain in rl_encap() if MGETHDR, MCLGET or
bus_dmamap_load_mbuf() fail.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/rtl81x9.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index 58a014644c9..5f17a12d26d 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtl81x9.c,v 1.50 2006/05/22 20:35:12 krw Exp $ */
+/* $OpenBSD: rtl81x9.c,v 1.51 2006/09/29 02:40:38 brad Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -854,15 +854,16 @@ int rl_encap(sc, m_head)
* TX buffers, plus we can only have one fragment buffer
* per packet. We have to copy pretty much all the time.
*/
-
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
+ if (m_new == NULL) {
+ m_freem(m_head);
return(1);
+ }
if (m_head->m_pkthdr.len > MHLEN) {
MCLGET(m_new, M_DONTWAIT);
-
if (!(m_new->m_flags & M_EXT)) {
m_freem(m_new);
+ m_freem(m_head);
return(1);
}
}
@@ -887,6 +888,7 @@ int rl_encap(sc, m_head)
if (bus_dmamap_load_mbuf(sc->sc_dmat, RL_CUR_TXMAP(sc),
m_new, BUS_DMA_NOWAIT) != 0) {
m_freem(m_new);
+ m_freem(m_head);
return (1);
}
m_freem(m_head);