--- a/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c Sat Feb 01 10:27:55 2014 -0800
+++ b/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c Mon Feb 03 14:00:43 2014 +0000
@@ -56,12 +56,20 @@
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(JNIEnv *env, jclass cls)
{
cls = (*env)->FindClass(env, "java/io/FileDescriptor");
+ CHECK_NULL(cls);
fd_fdID = (*env)->GetFieldID(env, cls, "fd", "I");
+ CHECK_NULL(fd_fdID);
cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
+ CHECK_NULL(cls);
isa_class = (*env)->NewGlobalRef(env, cls);
+ if (isa_class == NULL) {
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return;
+ }
isa_ctorID = (*env)->GetMethodID(env, cls, "<init>",
"(Ljava/net/InetAddress;I)V");
+ CHECK_NULL(isa_ctorID);
}
JNIEXPORT void JNICALL
@@ -99,10 +107,10 @@
(*env)->SetIntField(env, newfdo, fd_fdID, newfd);
remote_ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, (int *)&remote_port);
+ CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
- isa = (*env)->NewObject(env, isa_class, isa_ctorID,
- remote_ia, remote_port);
+ isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
+ CHECK_NULL_RETURN(isa, IOS_THROWN);
(*env)->SetObjectArrayElement(env, isaa, 0, isa);
-
return 1;
}