ByteBuf.release invocation missed in LZ4Codec and SnappyCodec

pull/762/head
Nikita 8 years ago
parent af6437dacd
commit 8fee0a1dfd

@ -63,7 +63,11 @@ public class LZ4Codec implements Codec {
LZ4SafeDecompressor decompressor = factory.safeDecompressor(); LZ4SafeDecompressor decompressor = factory.safeDecompressor();
bytes = decompressor.decompress(bytes, bytes.length*3); bytes = decompressor.decompress(bytes, bytes.length*3);
ByteBuf bf = Unpooled.wrappedBuffer(bytes); ByteBuf bf = Unpooled.wrappedBuffer(bytes);
return innerCodec.getValueDecoder().decode(bf, state); try {
return innerCodec.getValueDecoder().decode(bf, state);
} finally {
bf.release();
}
} }
}; };

@ -57,7 +57,11 @@ public class SnappyCodec implements Codec {
buf.readBytes(bytes); buf.readBytes(bytes);
bytes = Snappy.uncompress(bytes); bytes = Snappy.uncompress(bytes);
ByteBuf bf = Unpooled.wrappedBuffer(bytes); ByteBuf bf = Unpooled.wrappedBuffer(bytes);
return innerCodec.getValueDecoder().decode(bf, state); try {
return innerCodec.getValueDecoder().decode(bf, state);
} finally {
bf.release();
}
} }
}; };

Loading…
Cancel
Save