net/af_packet: handle possible null pointer

Fixes: 1b93c2aa81b4 ("net/af_packet: add interface name to internals")
Cc: stable@dpdk.org

Signed-off-by: Chas Williams <ciwillia@brocade.com>
This commit is contained in:
Chas Williams 2017-05-17 14:03:33 -04:00 committed by Ferruh Yigit
parent f28ede500c
commit 92656e96dd

View File

@ -630,6 +630,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
goto error_early;
}
(*internals)->if_name = strdup(pair->value);
if ((*internals)->if_name == NULL)
goto error_early;
(*internals)->if_index = ifr.ifr_ifindex;
if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {