Add missing code to free memory when the device initialization fails.
Fixes:
ccd37d341e8d ("net/af_packet: remove queue number limitation")
Fixes:
5f19dee604ed ("drivers/net: do not use private ethdev data")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
sizeof(struct pkt_tx_queue),
0, numa_node);
if (!(*internals)->rx_queue || !(*internals)->tx_queue) {
sizeof(struct pkt_tx_queue),
0, numa_node);
if (!(*internals)->rx_queue || !(*internals)->tx_queue) {
- rte_free((*internals)->rx_queue);
- rte_free((*internals)->tx_queue);
- return -1;
}
for (q = 0; q < nb_queues; q++) {
}
for (q = 0; q < nb_queues; q++) {
PMD_LOG(ERR,
"%s: I/F name too long (%s)",
name, pair->value);
PMD_LOG(ERR,
"%s: I/F name too long (%s)",
name, pair->value);
}
if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) {
PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFINDEX)", name);
}
if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) {
PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFINDEX)", name);
}
(*internals)->if_name = strdup(pair->value);
if ((*internals)->if_name == NULL)
}
(*internals)->if_name = strdup(pair->value);
if ((*internals)->if_name == NULL)
(*internals)->if_index = ifr.ifr_ifindex;
if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {
PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFHWADDR)", name);
(*internals)->if_index = ifr.ifr_ifindex;
if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {
PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFHWADDR)", name);
}
memcpy(&(*internals)->eth_addr, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
}
memcpy(&(*internals)->eth_addr, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
PMD_LOG_ERRNO(ERR,
"%s: could not open AF_PACKET socket",
name);
PMD_LOG_ERRNO(ERR,
"%s: could not open AF_PACKET socket",
name);
((*internals)->rx_queue[q].sockfd != qsockfd))
close((*internals)->rx_queue[q].sockfd);
}
((*internals)->rx_queue[q].sockfd != qsockfd))
close((*internals)->rx_queue[q].sockfd);
}
+free_internals:
+ rte_free((*internals)->rx_queue);
+ rte_free((*internals)->tx_queue);
free((*internals)->if_name);
rte_free(*internals);
return -1;
free((*internals)->if_name);
rte_free(*internals);
return -1;