8230861: missing ReleaseStringUTFChars in Java_sun_security_pkcs11_wrapper_PKCS11_connect
authormbaesken
Wed, 11 Sep 2019 16:54:53 +0200
changeset 58097 fa0514bdc09b
parent 58096 0d97bf7cf8a4
child 58098 ea93d6a9f720
8230861: missing ReleaseStringUTFChars in Java_sun_security_pkcs11_wrapper_PKCS11_connect Reviewed-by: alanb, stuefe
src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c
--- a/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c	Wed Sep 11 18:31:25 2019 -0700
+++ b/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c	Wed Sep 11 16:54:53 2019 +0200
@@ -109,6 +109,7 @@
         exceptionMessage = (char *) malloc(sizeof(char) * (strlen(systemErrorMessage) + strlen(libraryNameStr) + 1));
         if (exceptionMessage == NULL) {
             throwOutOfMemoryError(env, 0);
+            (*env)->ReleaseStringUTFChars(env, jPkcs11ModulePath, libraryNameStr);
             return;
         }
         strcpy(exceptionMessage, systemErrorMessage);