node: check Rx element allocation

As the possible failure of the malloc(), the not_checked and
checked could be NULL pointer.
Therefore, it should be better to check it in order to avoid
the dereference of the NULL pointer.

Fixes: fa8054c8c8 ("examples/eventdev: add thread safe Tx worker pipeline")
Cc: stable@dpdk.org

Signed-off-by: Shiqi Liu <835703180@qq.com>
This commit is contained in:
Shiqi Liu 2022-07-07 17:23:45 +08:00 committed by Thomas Monjalon
parent afe67d1414
commit d914c01036

View File

@ -77,6 +77,8 @@ rte_node_eth_config(struct rte_node_ethdev_config *conf, uint16_t nb_confs,
/* Add it to list of ethdev rx nodes for lookup */
elem = malloc(sizeof(ethdev_rx_node_elem_t));
if (elem == NULL)
return -ENOMEM;
memset(elem, 0, sizeof(ethdev_rx_node_elem_t));
elem->ctx.port_id = port_id;
elem->ctx.queue_id = j;