changeset 9623:289d5c0e4bd7

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
author msheppar
date Fri, 30 May 2014 13:36:23 +0100
parents 429210228042
children d8827fb970a9
files src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Fri May 30 13:28:19 2014 +0100
+++ b/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Fri May 30 13:36:23 2014 +0100
@@ -1118,11 +1118,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;
 }
@@ -1157,13 +1159,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;
 }