You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2015/11/04 18:14:58 UTC

svn commit: r1712593 - /tomcat/native/trunk/native/src/sslcontext.c

Author: kkolinko
Date: Wed Nov  4 17:14:58 2015
New Revision: 1712593

URL: http://svn.apache.org/viewvc?rev=1712593&view=rev
Log:
Explicitly cleanup jstring reference in callback method ssl_callback_ServerNameIndication().

I think it is better to cleanup it explicitly, as it is a callback method,
although stacktraces in BZ 58566 indicate that invocation chain starts with a java method, org.apache.tomcat.jni.SSLSocket.handshake().

Modified:
    tomcat/native/trunk/native/src/sslcontext.c

Modified: tomcat/native/trunk/native/src/sslcontext.c
URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/sslcontext.c?rev=1712593&r1=1712592&r2=1712593&view=diff
==============================================================================
--- tomcat/native/trunk/native/src/sslcontext.c (original)
+++ tomcat/native/trunk/native/src/sslcontext.c Wed Nov  4 17:14:58 2015
@@ -119,10 +119,14 @@ int ssl_callback_ServerNameIndication(SS
                                                    original_ssl_context,
                                                    hostname);
 
+    // Delete the local reference as this method is called via callback.
+    // Otherwise local references are only freed once jni method returns.
+    (*env)->DeleteLocalRef(env, hostname);
+
     if (new_ssl_context != 0 && new_ssl_context != original_ssl_context) {
         new_c = J2P(new_ssl_context, tcn_ssl_ctxt_t *);
         SSL_set_SSL_CTX(ssl, new_c->ctx);
-	}
+    }
 
     return SSL_TLSEXT_ERR_OK;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org