net/mlx5: fix leak on Rx queue creation failure
authorMichael Baum <michaelba@nvidia.com>
Wed, 11 Nov 2020 07:36:45 +0000 (07:36 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sat, 14 Nov 2020 00:36:19 +0000 (01:36 +0100)
In Rx queue creation, there is a validation for the Rx configuration.

When scatter offload validation for buffer split is failed, the Rx queue
object memory was not freed what caused a memory leak.

Free it.

Fixes: a0a45e8af723 ("net/mlx5: configure Rx queue for buffer split")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_rxq.c

index 4e6b8f4..0693c92 100644 (file)
@@ -1506,7 +1506,7 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
                        dev->data->port_id, idx, mb_len, max_rx_pkt_len,
                        RTE_PKTMBUF_HEADROOM);
                rte_errno = ENOSPC;
-               return NULL;
+               goto error;
        }
        tmpl->type = MLX5_RXQ_TYPE_STANDARD;
        if (mlx5_mr_btree_init(&tmpl->rxq.mr_ctrl.cache_bh,