Add a missing available check and fix the wrong address passed
to munmap on init failure.
Fixes:
dd6590fe2fd7 ("af_packet: fix possible memory leak")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
if (qsockfd != -1)
close(qsockfd);
for (q = 0; q < nb_queues; q++) {
- munmap((*internals)->rx_queue[q].map,
- 2 * req->tp_block_size * req->tp_block_nr);
+ if ((*internals)->rx_queue[q].map != MAP_FAILED)
+ munmap((*internals)->rx_queue[q].map,
+ 2 * req->tp_block_size * req->tp_block_nr);
rte_free((*internals)->rx_queue[q].rd);
rte_free((*internals)->tx_queue[q].rd);