hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject svn commit: r1545868 - /hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java
Date Tue, 26 Nov 2013 22:24:29 GMT
Author: eclark
Date: Tue Nov 26 22:24:29 2013
New Revision: 1545868

URL: http://svn.apache.org/r1545868
Log:
HBASE-10035 Fix Potential Resource Leak in IPCUtils

Modified:
    hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java

Modified: hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java?rev=1545868&r1=1545867&r2=1545868&view=diff
==============================================================================
--- hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java (original)
+++ hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java Tue Nov
26 22:24:29 2013
@@ -170,10 +170,11 @@ class IPCUtil {
       CompressionInputStream cis =
         compressor.createInputStream(new ByteArrayInputStream(cellBlock, offset, length),
         poolDecompressor);
+      ByteBufferOutputStream bbos = null;
       try {
         // TODO: This is ugly.  The buffer will be resized on us if we guess wrong.
         // TODO: Reuse buffers.
-        ByteBufferOutputStream bbos = new ByteBufferOutputStream((length - offset) *
+        bbos = new ByteBufferOutputStream((length - offset) *
           this.cellBlockDecompressionMultiplier);
         IOUtils.copy(cis, bbos);
         bbos.close();
@@ -181,6 +182,8 @@ class IPCUtil {
         is = new ByteArrayInputStream(bb.array(), 0, bb.limit());
       } finally {
         if (is != null) is.close();
+        if (bbos != null) bbos.close();
+
         CodecPool.returnDecompressor(poolDecompressor);
       }
     } else {



Mime
View raw message