[dpdk-dev,v2] ring: fix minor memory free issue
Commit Message
Fix minor memory free issue in error clean-up.
Fixes: 651c505af862 ("ring: enhance device setup from rings")
Reported-by Coverity (CID 119258)
Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
V2:
* Add fixline.
drivers/net/ring/rte_eth_ring.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
@@ -363,9 +363,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
return data->port_id;
error:
- rte_free(data->rx_queues);
- rte_free(data->tx_queues);
- rte_free(data);
+ if (data) {
+ rte_free(data->rx_queues);
+ rte_free(data->tx_queues);
+ rte_free(data);
+ }
rte_free(internals);
return -1;