diff options
author | Patrick Latifi <pat@cvs.openbsd.org> | 2004-11-29 20:15:41 +0000 |
---|---|---|
committer | Patrick Latifi <pat@cvs.openbsd.org> | 2004-11-29 20:15:41 +0000 |
commit | 5b4eeca7ef99173c1659fffcdb71a19f41bb6f5d (patch) | |
tree | 4d525b8d63abe7eaea45a8bb80582374ce885bcc | |
parent | 5688e5e087054a34f5667f294d21ec5a13f6e837 (diff) |
plug memory leaks on error
ok canacar markus millert
-rw-r--r-- | sys/arch/i386/isa/isa_machdep.c | 4 | ||||
-rw-r--r-- | sys/net/if_pppoe.c | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c index 1346d76882a..5581d4848d5 100644 --- a/sys/arch/i386/isa/isa_machdep.c +++ b/sys/arch/i386/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.c,v 1.50 2004/06/28 01:41:53 aaron Exp $ */ +/* $OpenBSD: isa_machdep.c,v 1.51 2004/11/29 20:15:40 pat Exp $ */ /* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */ #define ISA_DMA_STATS @@ -575,6 +575,7 @@ isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what) if (!LEGAL_IRQ(irq) || type == IST_NONE) { printf("%s: isa_intr_establish: bogus irq or type\n", ih_what); + free(ih, M_DEVBUF); return (NULL); } switch (intrtype[irq]) { @@ -590,6 +591,7 @@ isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what) /*printf("%s: intr_establish: can't share %s with %s, irq %d\n", ih_what, isa_intr_typename(intrtype[irq]), isa_intr_typename(type), irq);*/ + free(ih, M_DEVBUF); return (NULL); } break; diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index 3d4583eeea9..1c541608c16 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppoe.c,v 1.1 2004/11/28 23:39:45 canacar Exp $ */ +/* $OpenBSD: if_pppoe.c,v 1.2 2004/11/29 20:15:40 pat Exp $ */ /* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */ /* @@ -809,12 +809,15 @@ pppoe_output(struct pppoe_softc *sc, struct mbuf *m) u_int16_t etype; if (sc->sc_eth_if == NULL) { - m_free(m); + m_freem(m); return (EIO); } - if ((sc->sc_eth_if->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) + if ((sc->sc_eth_if->if_flags & (IFF_UP|IFF_RUNNING)) + != (IFF_UP|IFF_RUNNING)) { + m_freem(m); return (ENETDOWN); + } memset(&dst, 0, sizeof dst); dst.sa_family = AF_UNSPEC; |