File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3908,11 +3908,24 @@ JNIEXPORT void JNICALL Java_com_wolfssl_WolfSSLSession_setVerify
39083908 return ;
39093909 }
39103910
3911+ /* Release global reference if already set, before setting again */
3912+ appData = (SSLAppData * )wolfSSL_get_app_data (ssl );
3913+ if (appData != NULL ) {
3914+ verifyCb = appData -> g_verifySSLCbIfaceObj ;
3915+ if (verifyCb != NULL ) {
3916+ (* jenv )-> DeleteGlobalRef (jenv , (jobject )(* verifyCb ));
3917+ XFREE (verifyCb , NULL , DYNAMIC_TYPE_TMP_BUFFER );
3918+ verifyCb = NULL ;
3919+ appData -> g_verifySSLCbIfaceObj = NULL ;
3920+ }
3921+ }
3922+
3923+ /* Set verify callback to NULL (reset), or passed in callback */
39113924 if (!callbackIface ) {
39123925 wolfSSL_set_verify (ssl , mode , NULL );
39133926 }
39143927 else {
3915- /* get app data to store verify callback jobject */
3928+ /* Get app data to store verify callback jobject */
39163929 appData = (SSLAppData * )wolfSSL_get_app_data (ssl );
39173930 if (appData == NULL ) {
39183931 printf ("Error getting app data from WOLFSSL\n" );
You can’t perform that action at this time.
0 commit comments