6909089: Memory leak occurs by lack of free for read buffer in SocketInputStream#read()
authorchegar
Thu, 10 Dec 2009 15:52:19 +0000
changeset 4508 6675f4c35817
parent 4505 d700fabf6b6c
child 4509 dd1cb7cc3afc
6909089: Memory leak occurs by lack of free for read buffer in SocketInputStream#read() Reviewed-by: alanb, jccollet
jdk/src/windows/native/java/net/SocketInputStream.c
--- a/jdk/src/windows/native/java/net/SocketInputStream.c	Wed Dec 09 21:09:38 2009 -0800
+++ b/jdk/src/windows/native/java/net/SocketInputStream.c	Thu Dec 10 15:52:19 2009 +0000
@@ -121,6 +121,9 @@
             newfd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
             if (newfd == -1) {
                 NET_ThrowSocketException(env, "Socket Closed");
+                if (bufP != BUF) {
+                    free(bufP);
+                }
                 return -1;
             }
         }