openssl-pkcs11/SOURCES/openssl-pkcs11-0.4.8-fix-leak-rsa-object-pkcs11-store-key.patch
2021-09-09 23:19:57 +00:00

26 lines
738 B
Diff

From e420b22fab9b81d7f4ec8c82bd836269c9d2dc51 Mon Sep 17 00:00:00 2001
From: lbonn <bonnans.l@gmail.com>
Date: Thu, 30 Aug 2018 14:48:24 +0200
Subject: [PATCH 11/23] Fix leak of RSA object in pkcs11_store_key()
EVP_PKEY_get1_RSA() increments the reference count
---
src/p11_key.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/p11_key.c b/src/p11_key.c
index 1e99e0d..6fb844f 100644
--- a/src/p11_key.c
+++ b/src/p11_key.c
@@ -265,6 +265,7 @@ static int pkcs11_store_key(PKCS11_TOKEN *token, EVP_PKEY *pk,
RSA_get0_key(rsa, &rsa_n, &rsa_e, &rsa_d);
RSA_get0_factors(rsa, &rsa_p, &rsa_q);
RSA_get0_crt_params(rsa, &rsa_dmp1, &rsa_dmq1, &rsa_iqmp);
+ RSA_free(rsa);
#else
rsa_n=rsa->n;
rsa_e=rsa->e;
--
2.17.1