Ensure BufUtil.release() is called even if writeBytes() fails in writeAndRelease()

This commit is contained in:
Trustin Lee 2013-04-04 14:50:25 +09:00
parent 015e60b00f
commit 03955428bc

View File

@ -167,7 +167,10 @@ final class OutputMessageBuf extends DefaultMessageBuf<Object> {
} }
private static void writeAndRelease(ByteBuf dst, ByteBuf src) { private static void writeAndRelease(ByteBuf dst, ByteBuf src) {
dst.writeBytes(src, src.readerIndex(), src.readableBytes()); try {
BufUtil.release(src); dst.writeBytes(src, src.readerIndex(), src.readableBytes());
} finally {
BufUtil.release(src);
}
} }
} }