From a686efe6ac9be1d68648950ff48515f522df9b31 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Mon, 10 Mar 2008 14:32:51 -0700 Subject: [PATCH] 6632696: Writing to closed output files (writeBytes) leaks native memory (unix) Reviewed-by: alanb, iris --- jdk/src/share/native/java/io/io_util.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jdk/src/share/native/java/io/io_util.c b/jdk/src/share/native/java/io/io_util.c index 4f7372babb9..f8fc714bbdc 100644 --- a/jdk/src/share/native/java/io/io_util.c +++ b/jdk/src/share/native/java/io/io_util.c @@ -40,7 +40,7 @@ readSingle(JNIEnv *env, jobject this, jfieldID fid) { 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 @@ readBytes(JNIEnv *env, jobject this, jbyteArray bytes, fd = GET_FD(this, fid); if (fd == -1) { - JNU_ThrowIOException (env, "Stream Closed"); + JNU_ThrowIOException(env, "Stream Closed"); return -1; } @@ -121,7 +121,7 @@ writeSingle(JNIEnv *env, jobject this, jint byte, jfieldID fid) { 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 @@ writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, 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) {