diff options
author | 2015-05-12 12:56:47 +0000 | |
---|---|---|
committer | 2015-05-12 12:56:47 +0000 | |
commit | d306bdb3d6788ea6d79bca561a3443db594b91f3 (patch) | |
tree | e5e4447e9736722befee0d8ac37e4073631d2b0b | |
parent | This file is only compiled when "pseudo-device bridge" is included in (diff) | |
download | wireguard-openbsd-d306bdb3d6788ea6d79bca561a3443db594b91f3.tar.xz wireguard-openbsd-d306bdb3d6788ea6d79bca561a3443db594b91f3.zip |
Fixup potential use after free and a memory leak.
Found by Maxime Villard <max at m00nbsd ! net> with the Brainy Code Scanner,
thanks!
-rw-r--r-- | sys/dev/pci/hifn7751.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index d3ff0c5529d..d3829a70895 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.169 2014/07/13 23:10:23 deraadt Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.170 2015/05/12 12:56:47 mikeb Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -2754,8 +2754,10 @@ hifn_mkmbuf_chain(int totlen, struct mbuf *mtemplate) } } MCLGET(m0, M_DONTWAIT); - if (!(m0->m_flags & M_EXT)) + if (!(m0->m_flags & M_EXT)) { m_freem(m0); + return (NULL); + } len = MCLBYTES; totlen -= len; @@ -2770,6 +2772,7 @@ hifn_mkmbuf_chain(int totlen, struct mbuf *mtemplate) } MCLGET(m, M_DONTWAIT); if (!(m->m_flags & M_EXT)) { + m_free(m); m_freem(m0); return (NULL); } |