there are some m_freem's missing in the error code paths.
i guess that's because freebsd code is a bit different
and we didn't look closely at it.

ok?

diff --git dev/pci/if_ix.c dev/pci/if_ix.c
index 4468401..8ab83f8 100644
--- dev/pci/if_ix.c
+++ dev/pci/if_ix.c
@@ -2547,7 +2547,7 @@ ixgbe_get_buf(struct rx_ring *rxr, int i)
 {
        struct ix_softc         *sc = rxr->sc;
        struct ixgbe_rx_buf     *rxbuf;
-       struct mbuf             *mh, *mp;
+       struct mbuf             *mp, *mh = NULL;
        int                     error;
        union ixgbe_adv_rx_desc *rxdesc;
        size_t                   dsize = sizeof(union ixgbe_adv_rx_desc);
@@ -2571,8 +2571,10 @@ ixgbe_get_buf(struct rx_ring *rxr, int i)
                goto no_split;
 
        mh = m_gethdr(M_DONTWAIT, MT_DATA);
-       if (mh == NULL)
+       if (mh == NULL) {
+               m_freem(mp);
                return (ENOBUFS);
+       }
 
        mh->m_pkthdr.len = mh->m_len = MHLEN;
        mh->m_len = MHLEN;
@@ -2582,6 +2584,7 @@ ixgbe_get_buf(struct rx_ring *rxr, int i)
        error = bus_dmamap_load_mbuf(rxr->rxdma.dma_tag, rxbuf->hmap,
            mh, BUS_DMA_NOWAIT);
        if (error) {
+               m_freem(mp);
                m_freem(mh);
                return (error);
        }
@@ -2601,6 +2604,8 @@ no_split:
        error = bus_dmamap_load_mbuf(rxr->rxdma.dma_tag, rxbuf->pmap,
            mp, BUS_DMA_NOWAIT);
        if (error) {
+               if (mh)
+                       m_freem(mh);
                m_freem(mp);
                return (error);
        }

Reply via email to