DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/openssl: fix memory leak
@ 2023-05-17 16:44 Gowrishankar Muthukrishnan
  2023-05-17 16:48 ` Akhil Goyal
  2023-05-17 16:49 ` Ji, Kai
  0 siblings, 2 replies; 3+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-05-17 16:44 UTC (permalink / raw)
  To: dev; +Cc: anoobj, Akhil Goyal, Kai Ji, Gowrishankar Muthukrishnan

Memory allocated through OPENSSL_malloc should be freed only
through OPENSSL_free.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 384d262621..f65fbca300 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -1927,7 +1927,7 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op *cop,
 
 	if (EVP_PKEY_sign(dsa_ctx, dsa_sign_data, &outlen, op->message.data,
 						op->message.length) <= 0) {
-		free(dsa_sign_data);
+		OPENSSL_free(dsa_sign_data);
 		goto err_dsa_sign;
 	}
 
@@ -1935,7 +1935,7 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op *cop,
 	DSA_SIG *sign = d2i_DSA_SIG(NULL, &dsa_sign_data_p, outlen);
 	if (!sign) {
 		OPENSSL_LOG(ERR, "%s:%d\n", __func__, __LINE__);
-		free(dsa_sign_data);
+		OPENSSL_free(dsa_sign_data);
 		goto err_dsa_sign;
 	} else {
 		const BIGNUM *r = NULL, *s = NULL;
@@ -1947,7 +1947,7 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op *cop,
 	}
 
 	DSA_SIG_free(sign);
-	free(dsa_sign_data);
+	OPENSSL_free(dsa_sign_data);
 	return 0;
 
 err_dsa_sign:
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-17 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 16:44 [PATCH] crypto/openssl: fix memory leak Gowrishankar Muthukrishnan
2023-05-17 16:48 ` Akhil Goyal
2023-05-17 16:49 ` Ji, Kai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).