[PATCH] pipeline: fix IPsec crypto session leak

Cristian Dumitrescu cristian.dumitrescu at intel.com
Tue Feb 7 19:15:42 CET 2023


In case of rte_ipsec_session_prepare() error, the crypto session was
not freed, leading to its leakage.

Fixes: 20777eb5f913 ("pipeline: add IPsec")
Coverity issue: 383139

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
---
 lib/pipeline/rte_swx_ipsec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/pipeline/rte_swx_ipsec.c b/lib/pipeline/rte_swx_ipsec.c
index b23056e23e..6c217ee797 100644
--- a/lib/pipeline/rte_swx_ipsec.c
+++ b/lib/pipeline/rte_swx_ipsec.c
@@ -1719,7 +1719,11 @@ ipsec_session_create(struct rte_swx_ipsec *ipsec,
 	s->pkt_func.prepare.async = NULL;
 	s->pkt_func.process = NULL;
 
-	return rte_ipsec_session_prepare(s);
+	status = rte_ipsec_session_prepare(s);
+	if (status)
+		goto error;
+
+	return 0;
 
 error:
 	/* sa. */
-- 
2.34.1



More information about the dev mailing list