diff --git a/src/solaris/native/java/net/Inet6AddressImpl.c b/src/solaris/native/java/net/Inet6AddressImpl.c index 7ac26c0cbb6f1c53b67b19ceefd6815a8ca92dd9..eab898d1ad78e6dfb3f4764be11a85c5b916ada2 100644 --- a/src/solaris/native/java/net/Inet6AddressImpl.c +++ b/src/solaris/native/java/net/Inet6AddressImpl.c @@ -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 diff --git a/src/solaris/native/java/net/NetworkInterface.c b/src/solaris/native/java/net/NetworkInterface.c index 09ab89c2fef497edd4d9627dc7db92abd3e633aa..17889448cf8872bab1e482164517a97495e35acd 100644 --- a/src/solaris/native/java/net/NetworkInterface.c +++ b/src/solaris/native/java/net/NetworkInterface.c @@ -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; } diff --git a/src/solaris/native/java/net/net_util_md.c b/src/solaris/native/java/net/net_util_md.c index 67da52316a98918416769a974e3e453e2bf31a9c..f23f2fceff5686d3e34a7366196e57c72adf84a6 100644 --- a/src/solaris/native/java/net/net_util_md.c +++ b/src/solaris/native/java/net/net_util_md.c @@ -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;