提交 ba0f1ebb 编写于 作者: M msheppar

8068028: JNI exception pending in jdk/src/solaris/native/java/net

Summary: added null check to JNI function calls returns in Inet6AddressImpl.c net_util_md.c
Reviewed-by: chegar, coffeys
上级 5a0c7e18
......@@ -196,6 +196,10 @@ lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6)
}
name = (*env)->NewStringUTF(env, hostname);
if (name == NULL) {
freeifaddrs(ifa);
return NULL;
}
/* Iterate over the interfaces, and total up the number of IPv4 and IPv6
* addresses we have. Also keep a count of loopback addresses. We need to
......
......@@ -253,6 +253,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
if (name_utf == NULL) {
if (!(*env)->ExceptionCheck(env))
JNU_ThrowOutOfMemoryError(env, NULL);
freeif(ifs);
return NULL;
}
/*
......@@ -527,9 +528,9 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0(JNIEnv *
JNU_ThrowOutOfMemoryError(env, NULL);
return NULL;
}
if ((sock =openSocketWithFallback(env, name_utf)) < 0) {
if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
(*env)->ReleaseStringUTFChars(env, name, name_utf);
return JNI_FALSE;
return NULL;
}
......
......@@ -97,6 +97,7 @@ void setDefaultScopeID(JNIEnv *env, struct sockaddr *him)
CHECK_NULL(c);
ni_defaultIndexID = (*env)->GetStaticFieldID(
env, c, "defaultIndex", "I");
CHECK_NULL(ni_defaultIndexID);
ni_class = c;
}
int defaultIndex;
......@@ -119,6 +120,7 @@ int getDefaultScopeID(JNIEnv *env) {
CHECK_NULL_RETURN(c, 0);
ni_defaultIndexID = (*env)->GetStaticFieldID(env, c,
"defaultIndex", "I");
CHECK_NULL_RETURN(ni_defaultIndexID, 0);
ni_class = c;
}
int defaultIndex = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册