This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 148fd82f80 Free private keys after use
148fd82f80 is described below

commit 148fd82f80583e295d8e71356f54d400b63dd4c0
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Apr 8 16:47:31 2026 +0100

    Free private keys after use
---
 java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java | 4 ++++
 webapps/docs/changelog.xml                                         | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java 
b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
index 208d30b508..95a9c54749 100644
--- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
+++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
@@ -1082,8 +1082,10 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
                 X509_free(cert);
                 if (SSL_CTX_use_PrivateKey(state.sslCtx, key) <= 0) {
                     logLastError("openssl.errorLoadingPrivateKey");
+                    EVP_PKEY_free(key);
                     return false;
                 }
+                EVP_PKEY_free(key);
                 if (SSL_CTX_check_private_key(state.sslCtx) <= 0) {
                     logLastError("openssl.errorPrivateKeyCheck");
                     return false;
@@ -1262,8 +1264,10 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
                 X509_free(x509cert);
                 if (SSL_CTX_use_PrivateKey(state.sslCtx, privateKeyAddress) <= 
0) {
                     logLastError("openssl.errorLoadingPrivateKey");
+                    EVP_PKEY_free(privateKeyAddress);
                     return false;
                 }
+                EVP_PKEY_free(privateKeyAddress);
                 if (SSL_CTX_check_private_key(state.sslCtx) <= 0) {
                     logLastError("openssl.errorPrivateKeyCheck");
                     return false;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c507cf966a..7694369867 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -159,6 +159,10 @@
         Align HTTP/2 trailer fields with HTTP/1.1 and filter out any fields
         not permitted in trailers. (markt)
       </fix>
+      <fix>
+        Free private keys after use in FFM based connector configuration.
+        (markt) 
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to