|
|
d6181b |
From 60748f69d9e21cf4cfd0655a0d7b81a715e9ae04 Mon Sep 17 00:00:00 2001
|
|
|
d6181b |
From: Sumit Bose <sbose@redhat.com>
|
|
|
d6181b |
Date: Tue, 2 Jul 2019 21:58:15 +0200
|
|
|
d6181b |
Subject: [PATCH 7/7] p11_child: fix a memory leak and other memory mangement
|
|
|
d6181b |
issues
|
|
|
d6181b |
|
|
|
d6181b |
EVP_MD_CTX_create() was called without matching EVP_MD_CTX_destroy().
|
|
|
d6181b |
|
|
|
d6181b |
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
|
|
|
d6181b |
---
|
|
|
d6181b |
src/p11_child/p11_child_openssl.c | 6 ++++--
|
|
|
d6181b |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
d6181b |
|
|
|
d6181b |
diff --git a/src/p11_child/p11_child_openssl.c b/src/p11_child/p11_child_openssl.c
|
|
|
d6181b |
index 7233f39fd..64d2d759c 100644
|
|
|
d6181b |
--- a/src/p11_child/p11_child_openssl.c
|
|
|
d6181b |
+++ b/src/p11_child/p11_child_openssl.c
|
|
|
d6181b |
@@ -986,9 +986,9 @@ static int do_hash(TALLOC_CTX *mem_ctx, const EVP_MD *evp_md,
|
|
|
d6181b |
|
|
|
d6181b |
done:
|
|
|
d6181b |
|
|
|
d6181b |
+ EVP_MD_CTX_free(md_ctx);
|
|
|
d6181b |
if (ret != EOK) {
|
|
|
d6181b |
free(out);
|
|
|
d6181b |
- EVP_MD_CTX_free(md_ctx);
|
|
|
d6181b |
}
|
|
|
d6181b |
|
|
|
d6181b |
return ret;
|
|
|
d6181b |
@@ -1187,7 +1187,7 @@ static int sign_data(CK_FUNCTION_LIST *module, CK_SESSION_HANDLE session,
|
|
|
d6181b |
CK_RV rv;
|
|
|
d6181b |
CK_RV rv_f;
|
|
|
d6181b |
EVP_PKEY *cert_pub_key = NULL;
|
|
|
d6181b |
- EVP_MD_CTX *md_ctx;
|
|
|
d6181b |
+ EVP_MD_CTX *md_ctx = NULL;
|
|
|
d6181b |
int ret;
|
|
|
d6181b |
const EVP_MD *evp_md = NULL;
|
|
|
d6181b |
CK_BYTE *hash_val = NULL;
|
|
|
d6181b |
@@ -1358,6 +1358,8 @@ static int sign_data(CK_FUNCTION_LIST *module, CK_SESSION_HANDLE session,
|
|
|
d6181b |
ret = EOK;
|
|
|
d6181b |
|
|
|
d6181b |
done:
|
|
|
d6181b |
+ EVP_MD_CTX_destroy(md_ctx);
|
|
|
d6181b |
+ talloc_free(hash_val);
|
|
|
d6181b |
talloc_free(signature);
|
|
|
d6181b |
EVP_PKEY_free(cert_pub_key);
|
|
|
d6181b |
|
|
|
d6181b |
--
|
|
|
d6181b |
2.20.1
|
|
|
d6181b |
|