Fix resource leak in InternalAttribute.setValue()

This commit is contained in:
Trustin Lee 2014-01-19 16:53:43 +09:00
parent 9b38e8778c
commit 2389c71e81

View File

@ -31,7 +31,8 @@ final class InternalAttribute extends AbstractReferenceCounted implements Interf
private final List<ByteBuf> value = new ArrayList<ByteBuf>();
private final Charset charset;
private int size;
public InternalAttribute(Charset charset) {
InternalAttribute(Charset charset) {
this.charset = charset;
}
@ -66,6 +67,7 @@ final class InternalAttribute extends AbstractReferenceCounted implements Interf
ByteBuf old = this.value.set(rank, buf);
if (old != null) {
size -= old.readableBytes();
old.release();
}
size += buf.readableBytes();
}