ring: fix memory freeing on error
authorJohn McNamara <john.mcnamara@intel.com>
Fri, 6 Nov 2015 17:28:37 +0000 (17:28 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 6 Nov 2015 23:08:36 +0000 (00:08 +0100)
Fix minor memory free issue in error clean-up.

Reported-by Coverity (CID 119258)

Fixes: 651c505af862 ("ring: enhance device setup from rings")

Signed-off-by: John McNamara <john.mcnamara@intel.com>
drivers/net/ring/rte_eth_ring.c

index cc60008..9a31bce 100644 (file)
@@ -363,8 +363,10 @@ 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);
+       if (data) {
+               rte_free(data->rx_queues);
+               rte_free(data->tx_queues);
+       }
        rte_free(data);
        rte_free(internals);