=== modified file 'src/com/mysql/jdbc/CompressedInputStream.java' --- src/com/mysql/jdbc/CompressedInputStream.java revid:alexander.soklakov@oracle.com-20130419054601-lmk8m848941a5u35 +++ src/com/mysql/jdbc/CompressedInputStream.java 2013-05-13 09:41:46 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. The MySQL Connector/J is licensed under the terms of the GPLv2 @@ -91,8 +91,10 @@ * @see java.io.InputStream#close() */ public void close() throws IOException { + this.connection = null; this.in.close(); this.buffer = null; + this.inflater.end(); this.inflater = null; } === modified file 'src/com/mysql/jdbc/ConnectionImpl.java' --- src/com/mysql/jdbc/ConnectionImpl.java revid:alexander.soklakov@oracle.com-20130419054601-lmk8m848941a5u35 +++ src/com/mysql/jdbc/ConnectionImpl.java 2013-04-10 15:02:00 +0000 @@ -1444,6 +1444,7 @@ } catch (Throwable t) { // can't do anything about it, and we're forcibly aborting } + this.io.releaseResources(); this.io = null; } @@ -1460,10 +1461,12 @@ */ private void cleanup(Throwable whyCleanedUp) { try { - if ((this.io != null) && !isClosed()) { - realClose(false, false, false, whyCleanedUp); - } else if (this.io != null) { - this.io.forceClose(); + if (this.io != null) { + if (isClosed()) { + this.io.forceClose(); + } else { + realClose(false, false, false, whyCleanedUp); + } } } catch (SQLException sqlEx) { // ignore, we're going away. @@ -4715,6 +4718,7 @@ } } finally { this.openStatements = null; + this.io.releaseResources(); this.io = null; this.statementInterceptors = null; this.exceptionInterceptor = null; === modified file 'src/com/mysql/jdbc/MysqlIO.java' --- src/com/mysql/jdbc/MysqlIO.java revid:alexander.soklakov@oracle.com-20130419054601-lmk8m848941a5u35 +++ src/com/mysql/jdbc/MysqlIO.java 2013-04-10 12:22:00 +0000 @@ -3349,6 +3349,9 @@ byte[] bytesToCompress = packet.getByteBuffer(); compressedBytes = new byte[bytesToCompress.length * 2]; + if (this.deflater == null) { + this.deflater = new Deflater(); + } this.deflater.reset(); this.deflater.setInput(bytesToCompress, offset, packetLen); this.deflater.finish(); @@ -5322,4 +5325,11 @@ throw sqlEx; } } + + protected void releaseResources() { + if (this.deflater != null) { + this.deflater.end(); + this.deflater = null; + } + } } \ No newline at end of file