The cleanup code on error checks for *internals being NULL only after
using the pointer to perform other cleanup. Fix this by moving the
clean-up based on the pointer inside the check for NULL.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
rte_free(data);
if (pci_dev)
rte_free(pci_dev);
- for (q = 0; q < nb_queues; q++) {
- if ((*internals)->rx_queue[q].rd)
- rte_free((*internals)->rx_queue[q].rd);
- if ((*internals)->tx_queue[q].rd)
- rte_free((*internals)->tx_queue[q].rd);
- }
- if (*internals)
+ if (*internals) {
+ for (q = 0; q < nb_queues; q++) {
+ if ((*internals)->rx_queue[q].rd)
+ rte_free((*internals)->rx_queue[q].rd);
+ if ((*internals)->tx_queue[q].rd)
+ rte_free((*internals)->tx_queue[q].rd);
+ }
rte_free(*internals);
+ }
return -1;
}