[PATCH 03/20] crypto/dpaa2_sec: fix memory leaks in error handlings
Weiguo Li
liwg06 at foxmail.com
Tue Feb 22 19:18:01 CET 2022
When function returned from error handling branches, the memories were
not freed which caused a memory leak.
Fixes: 8d1f3a5d751b ("crypto/dpaa2_sec: support crypto operation")
Signed-off-by: Weiguo Li <liwg06 at foxmail.com>
---
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index e62d04852b..3f8d4d213f 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2037,12 +2037,15 @@ dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
RTE_CACHE_LINE_SIZE);
if (!qp->rx_vq.q_storage) {
DPAA2_SEC_ERR("malloc failed for q_storage");
+ rte_free(qp);
return -ENOMEM;
}
memset(qp->rx_vq.q_storage, 0, sizeof(struct queue_storage_info_t));
if (dpaa2_alloc_dq_storage(qp->rx_vq.q_storage)) {
DPAA2_SEC_ERR("Unable to allocate dequeue storage");
+ rte_free(qp->rx_vq.q_storage);
+ rte_free(qp);
return -ENOMEM;
}
--
2.25.1
More information about the dev
mailing list