changeset 21:b8fc7b5498dd

6632696: Writing to closed output files (writeBytes) leaks native memory (unix) Reviewed-by: alanb, iris
author martin
date Mon, 10 Mar 2008 14:32:51 -0700
parents 1d12b16c7df9
children 81f76ad22a63
files src/share/native/java/io/io_util.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/java/io/io_util.c	Mon Mar 10 14:32:50 2008 -0700
+++ b/src/share/native/java/io/io_util.c	Mon Mar 10 14:32:51 2008 -0700
@@ -40,7 +40,7 @@
     char ret;
     FD fd = GET_FD(this, fid);
     if (fd == -1) {
-        JNU_ThrowIOException (env, "Stream Closed");
+        JNU_ThrowIOException(env, "Stream Closed");
         return -1;
     }
     nread = IO_Read(fd, &ret, 1);
@@ -94,7 +94,7 @@
 
     fd = GET_FD(this, fid);
     if (fd == -1) {
-        JNU_ThrowIOException (env, "Stream Closed");
+        JNU_ThrowIOException(env, "Stream Closed");
         return  -1;
     }
 
@@ -121,7 +121,7 @@
     int n;
     FD fd = GET_FD(this, fid);
     if (fd == -1) {
-        JNU_ThrowIOException (env, "Stream Closed");
+        JNU_ThrowIOException(env, "Stream Closed");
         return;
     }
     n = IO_Write(fd, &c, 1);
@@ -172,8 +172,8 @@
         while (len > 0) {
             fd = GET_FD(this, fid);
             if (fd == -1) {
-                JNU_ThrowIOException (env, "Stream Closed");
-                return;
+                JNU_ThrowIOException(env, "Stream Closed");
+                break;
             }
             n = IO_Write(fd, buf+off, len);
             if (n == JVM_IO_ERR) {