diff options
-rw-r--r-- | ring_rx.c | 7 | ||||
-rw-r--r-- | ring_tx.c | 7 |
2 files changed, 6 insertions, 8 deletions
@@ -23,16 +23,15 @@ void destroy_rx_ring(int sock, struct ring *ring) { int ret; - fmemset(&ring->layout, 0, sizeof(ring->layout)); + munmap(ring->mm_space, ring->mm_len); + ring->mm_len = 0; + fmemset(&ring->layout, 0, sizeof(ring->layout)); ret = setsockopt(sock, SOL_PACKET, PACKET_RX_RING, &ring->layout, sizeof(ring->layout)); if (unlikely(ret)) panic("Cannot destroy the RX_RING!\n"); - munmap(ring->mm_space, ring->mm_len); - ring->mm_len = 0; - xfree(ring->frames); } @@ -33,16 +33,15 @@ void destroy_tx_ring(int sock, struct ring *ring) { int ret; - fmemset(&ring->layout, 0, sizeof(ring->layout)); + munmap(ring->mm_space, ring->mm_len); + ring->mm_len = 0; + fmemset(&ring->layout, 0, sizeof(ring->layout)); ret = setsockopt(sock, SOL_PACKET, PACKET_TX_RING, &ring->layout, sizeof(ring->layout)); if (unlikely(ret)) panic("Cannot destroy the TX_RING!\n"); - munmap(ring->mm_space, ring->mm_len); - ring->mm_len = 0; - xfree(ring->frames); } |