提交 f698cb32 编写于 作者: W weijun

8035759: [parfait] JNI exception pending in jdk/src/windows/native/sun/security/krb5/NativeCreds.c

Reviewed-by: valeriep
上级 b7db9647
...@@ -463,6 +463,10 @@ JNIEXPORT jobject JNICALL Java_sun_security_krb5_Credentials_acquireDefaultNativ ...@@ -463,6 +463,10 @@ JNIEXPORT jobject JNICALL Java_sun_security_krb5_Credentials_acquireDefaultNativ
netypes = (*env)->GetArrayLength(env, jetypes); netypes = (*env)->GetArrayLength(env, jetypes);
etypes = (jint *) (*env)->GetIntArrayElements(env, jetypes, NULL); etypes = (jint *) (*env)->GetIntArrayElements(env, jetypes, NULL);
if (etypes == NULL) {
break;
}
// check TGT validity // check TGT validity
if (native_debug) { if (native_debug) {
printf("LSA: TICKET SessionKey KeyType is %d\n", msticket->SessionKey.KeyType); printf("LSA: TICKET SessionKey KeyType is %d\n", msticket->SessionKey.KeyType);
...@@ -952,8 +956,7 @@ jobject BuildPrincipal(JNIEnv *env, PKERB_EXTERNAL_NAME principalName, ...@@ -952,8 +956,7 @@ jobject BuildPrincipal(JNIEnv *env, PKERB_EXTERNAL_NAME principalName,
if (native_debug) { if (native_debug) {
printf("LSA: Can't allocate String array for Principal\n"); printf("LSA: Can't allocate String array for Principal\n");
} }
LocalFree(realm); goto cleanup;
return principal;
} }
for (i=0; i<nameCount; i++) { for (i=0; i<nameCount; i++) {
...@@ -963,18 +966,32 @@ jobject BuildPrincipal(JNIEnv *env, PKERB_EXTERNAL_NAME principalName, ...@@ -963,18 +966,32 @@ jobject BuildPrincipal(JNIEnv *env, PKERB_EXTERNAL_NAME principalName,
// OK, got a Char array, so construct a String // OK, got a Char array, so construct a String
tempString = (*env)->NewString(env, (const jchar*)scanner->Buffer, tempString = (*env)->NewString(env, (const jchar*)scanner->Buffer,
scanner->Length/sizeof(WCHAR)); scanner->Length/sizeof(WCHAR));
if (tempString == NULL) {
goto cleanup;
}
// Set the String into the StringArray // Set the String into the StringArray
(*env)->SetObjectArrayElement(env, stringArray, i, tempString); (*env)->SetObjectArrayElement(env, stringArray, i, tempString);
if ((*env)->ExceptionCheck(env)) {
goto cleanup;
}
// Do I have to worry about storage reclamation here? // Do I have to worry about storage reclamation here?
} }
// now set the realm in the principal // now set the realm in the principal
realmLen = (ULONG)wcslen((PWCHAR)realm); realmLen = (ULONG)wcslen((PWCHAR)realm);
realmStr = (*env)->NewString(env, (PWCHAR)realm, (USHORT)realmLen); realmStr = (*env)->NewString(env, (PWCHAR)realm, (USHORT)realmLen);
if (realmStr == NULL) {
goto cleanup;
}
principal = (*env)->NewObject(env, principalNameClass, principal = (*env)->NewObject(env, principalNameClass,
principalNameConstructor, stringArray, realmStr); principalNameConstructor, stringArray, realmStr);
cleanup:
// free local resources // free local resources
LocalFree(realm); LocalFree(realm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册