diff --git a/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c b/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c index dc8378b741b3b2256f95a9601a57f2d1bfcadb8b..566d2aeca325fcc0a9d2d4bb28300e7367c770e7 100644 --- a/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c +++ b/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c @@ -1118,11 +1118,13 @@ Java_sun_nio_fs_WindowsNativeDispatcher_GetFullPathName0(JNIEnv *env, JNU_ThrowInternalError(env, "GetFullPathNameW failed"); } free(lpBuf); + } else { + JNU_ThrowOutOfMemoryError(env, "native memory allocation failure"); } } - } - if (len == 0) + } else { throwWindowsException(env, GetLastError()); + } return rv; } @@ -1157,13 +1159,13 @@ Java_sun_nio_fs_WindowsNativeDispatcher_GetFinalPathNameByHandle(JNIEnv* env, JNU_ThrowInternalError(env, "GetFinalPathNameByHandleW failed"); } free(lpBuf); + } else { + JNU_ThrowOutOfMemoryError(env, "native memory allocation failure"); } } - } - - if (len == 0) + } else { throwWindowsException(env, GetLastError()); - + } return rv; }