Fix resource leak in InternalAttribute.setValue()
This commit is contained in:
parent
9b38e8778c
commit
2389c71e81
@ -31,7 +31,8 @@ final class InternalAttribute extends AbstractReferenceCounted implements Interf
|
|||||||
private final List<ByteBuf> value = new ArrayList<ByteBuf>();
|
private final List<ByteBuf> value = new ArrayList<ByteBuf>();
|
||||||
private final Charset charset;
|
private final Charset charset;
|
||||||
private int size;
|
private int size;
|
||||||
public InternalAttribute(Charset charset) {
|
|
||||||
|
InternalAttribute(Charset charset) {
|
||||||
this.charset = charset;
|
this.charset = charset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +67,7 @@ final class InternalAttribute extends AbstractReferenceCounted implements Interf
|
|||||||
ByteBuf old = this.value.set(rank, buf);
|
ByteBuf old = this.value.set(rank, buf);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
size -= old.readableBytes();
|
size -= old.readableBytes();
|
||||||
|
old.release();
|
||||||
}
|
}
|
||||||
size += buf.readableBytes();
|
size += buf.readableBytes();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user