From 1389716db417a4b52f54fc4a72efb1a578e2ac46 Mon Sep 17 00:00:00 2001 From: liuxueli Date: Fri, 11 Jun 2021 14:02:14 +0800 Subject: 修复: TSG-6618: 调用X509_get_pubkey后需要使用EVP_PKEY_free进行释放,参照: https://www.openssl.org/docs/man1.1.0/man3/X509_get_pubkey.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SSL_Certificate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/SSL_Certificate.c b/src/SSL_Certificate.c index 8ffbbc9..de7312b 100644 --- a/src/SSL_Certificate.c +++ b/src/SSL_Certificate.c @@ -1108,7 +1108,9 @@ UCHAR fn_pGetSSLInfo(char *pcCert, int iLen, ssl_stream *a_ssl_stream, struct a_ssl_stream->stSSLCert->SSLSubKeyLen = i2d_PublicKey(pkey, NULL);; a_ssl_stream->stSSLCert->SSLSubKey = (unsigned char *)dictator_malloc(thread_seq, a_ssl_stream->stSSLCert->SSLSubKeyLen); pkeyLen = i2d_PublicKey(pkey, &(a_ssl_stream->stSSLCert->SSLSubKey)); //!!! point will be changed - a_ssl_stream->stSSLCert->SSLSubKey = a_ssl_stream->stSSLCert->SSLSubKey-a_ssl_stream->stSSLCert->SSLSubKeyLen; + a_ssl_stream->stSSLCert->SSLSubKey = a_ssl_stream->stSSLCert->SSLSubKey-a_ssl_stream->stSSLCert->SSLSubKeyLen; + + EVP_PKEY_free(pkey); } /*validity*/ -- cgit v1.2.3