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

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-native.git

commit 56c62efa322406d3b5d3e66131e292c25bf1dcf9
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Feb 4 15:20:11 2026 +0000

    Correctly use APi as pointed out by remm.
---
 native/src/sslcontext.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/native/src/sslcontext.c b/native/src/sslcontext.c
index b9c31ea4f..33889b3f3 100644
--- a/native/src/sslcontext.c
+++ b/native/src/sslcontext.c
@@ -1032,8 +1032,9 @@ TCN_IMPLEMENT_CALL(jboolean, SSLContext, 
setCertificate)(TCN_STDARGS, jlong ctx,
     /* XXX Does this also work for pkcs12 or only for PEM files?
      * If only for PEM files move above to the PEM handling */
     if ((idx == 0) && (evp = SSL_dh_GetParamFromFile(cert_file))) {
-        SSL_CTX_set0_tmp_dh_pkey(c->ctx, evp);
-        EVP_PKEY_free(evp);
+        if (!SSL_CTX_set0_tmp_dh_pkey(c->ctx, evp)) {
+            EVP_PKEY_free(evp);
+        }
     }
 
 #ifdef HAVE_ECC


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

Reply via email to