--- old/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c Thu Jan 22 14:30:07 2015 +++ new/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c Thu Jan 22 14:30:07 2015 @@ -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, "", "(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; }