Hi Matthias, this looks correct. Thanks for taking care of it.
Best regards Christoph From: Baesken, Matthias <matthias.baes...@sap.com> Sent: Freitag, 21. Februar 2020 13:18 To: security-dev@openjdk.java.net Cc: Langer, Christoph <christoph.lan...@sap.com> Subject: RE: RFR [XS]: 8239457: call ReleaseStringUTFChars before early returns in Java_sun_security_pkcs11_wrapper_PKCS11_connect Ping - any reviews please ? Best regards, Matthias From: Baesken, Matthias Sent: Mittwoch, 19. Februar 2020 13:55 To: security-dev@openjdk.java.net<mailto:security-dev@openjdk.java.net> Subject: RFR [XS]: 8239457: call ReleaseStringUTFChars before early returns in Java_sun_security_pkcs11_wrapper_PKCS11_connect Hello, please review this small change to unix Java_sun_security_pkcs11_wrapper_PKCS11_connect . Here we miss a call to ReleaseStringUTFChars before early returns , e.g. these early returns . 127 // with the old JAR file jGetFunctionList is null, temporarily check for that 128 if (jGetFunctionList != NULL) { 129 getFunctionListStr = (*env)->GetStringUTFChars(env, jGetFunctionList, 0); 130 if (getFunctionListStr == NULL) { 131 return; 132 } ... 135 } 136 if (C_GetFunctionList == NULL) { 137 throwIOException(env, "ERROR: C_GetFunctionList == NULL"); 138 return; 139 } else if ( (systemErrorMessage = dlerror()) != NULL ){ 140 throwIOException(env, systemErrorMessage); 141 return; 142 } Fix is to move the last call to (*env)->ReleaseStringUTFChars(env, jPkcs11ModulePath, libraryNameStr); Some lines forward in the function Java_sun_security_pkcs11_wrapper_PKCS11_connect . Bug/webrev : https://bugs.openjdk.java.net/browse/JDK-8239457 http://cr.openjdk.java.net/~mbaesken/webrevs/8239457.0/ Thanks, Matthias