Check for memory allocation failure is added to avoid null
pointer dereference.
Fixes: c378f084d6e3 ("compress/octeontx: add device setup ops")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
}
name = rte_malloc(NULL, RTE_COMPRESSDEV_NAME_MAX_LEN, 0);
+ if (name == NULL)
+ return (-ENOMEM);
snprintf(name, RTE_COMPRESSDEV_NAME_MAX_LEN,
"zip_pmd_%u_qp_%u",
dev->data->dev_id, qp_id);
/* Allocate the queue pair data structure. */
qp = rte_zmalloc_socket(name, sizeof(*qp),
RTE_CACHE_LINE_SIZE, socket_id);
- if (qp == NULL)
+ if (qp == NULL) {
+ rte_free(name);
return (-ENOMEM);
+ }
qp->name = name;