# HG changeset patch # User bpb # Date 1532008962 25200 # Node ID ee7b0da99262328fdf3e513d3ccbf1927da3a680 # Parent 205d2db1dc25d1e788ab9c61402dc1c61c3eaf7c 8206301: Improve NIO stability Reviewed-by: alanb, mschoene, rhalade diff -r 205d2db1dc25 -r ee7b0da99262 src/java.base/windows/native/libnio/ch/DatagramDispatcher.c --- a/src/java.base/windows/native/libnio/ch/DatagramDispatcher.c Thu Jun 14 23:47:05 2018 +0000 +++ b/src/java.base/windows/native/libnio/ch/DatagramDispatcher.c Thu Jul 19 07:02:42 2018 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,6 +95,10 @@ jint fd = fdval(env, fdo); struct iovec *iovp = (struct iovec *)address; WSABUF *bufs = malloc(len * sizeof(WSABUF)); + if (bufs == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); + return IOS_THROWN; + } /* copy iovec into WSABUF */ for(i=0; i WAKEUP_SOCKET_BUF_SIZE) { char* buf = (char*)malloc(bytesToRead); + if (buf == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); + return; + } recv(scinFd, buf, bytesToRead, 0); free(buf); } else {