Skip to content

Commit

Permalink
8239457: call ReleaseStringUTFChars before early returns in Java_sun_…
Browse files Browse the repository at this point in the history
…security_pkcs11_wrapper_PKCS11_connect

Reviewed-by: alanb, clanger
  • Loading branch information
MBaesken committed Feb 19, 2020
1 parent bd02894 commit 3f140fa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
*/

/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
Expand Down Expand Up @@ -93,7 +93,6 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect
}
TRACE1("DEBUG: connect to PKCS#11 module: %s ... ", libraryNameStr);


/*
* Load the PKCS #11 DLL
*/
Expand All @@ -119,6 +118,7 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect
free(exceptionMessage);
return;
}
(*env)->ReleaseStringUTFChars(env, jPkcs11ModulePath, libraryNameStr);

/*
* Get function pointer to C_GetFunctionList
Expand Down Expand Up @@ -156,7 +156,6 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect
globalPKCS11ImplementationReference = (*env)->NewGlobalRef(env, obj);
putModuleEntry(env, globalPKCS11ImplementationReference, moduleData);

(*env)->ReleaseStringUTFChars(env, jPkcs11ModulePath, libraryNameStr);
TRACE0("FINISHED\n");

if(ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; }
Expand Down

0 comments on commit 3f140fa

Please sign in to comment.