8036134: Check src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c for JNI pending exceptions
authormsheppar
Thu, 20 Mar 2014 16:19:08 +0000
changeset 23554 f65fec81a347
parent 23553 0d1adf0afc20
child 23555 679ad1863be3
8036134: Check src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c for JNI pending exceptions Summary: check malloc return value and added JUN_ThrowOutOfMemoryException Reviewed-by: alanb
jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
--- a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Thu Mar 20 15:25:57 2014 +0000
+++ b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Thu Mar 20 16:19:08 2014 +0000
@@ -1123,11 +1123,13 @@
                     JNU_ThrowInternalError(env, "GetFullPathNameW failed");
                 }
                 free(lpBuf);
+            } else {
+                JNU_ThrowOutOfMemoryError(env, "native memory allocation failure");
             }
         }
+    } else {
+        throwWindowsException(env, GetLastError());
     }
-    if (len == 0)
-        throwWindowsException(env, GetLastError());
 
     return rv;
 }
@@ -1162,13 +1164,13 @@
                     JNU_ThrowInternalError(env, "GetFinalPathNameByHandleW failed");
                 }
                 free(lpBuf);
+            } else {
+                JNU_ThrowOutOfMemoryError(env, "native memory allocation failure");
             }
         }
+    } else {
+        throwWindowsException(env, GetLastError());
     }
-
-    if (len == 0)
-        throwWindowsException(env, GetLastError());
-
     return rv;
 }