Avoid memory leak when encoding the key
This commit is contained in:
parent
eb308cfff6
commit
c78544cfaa
@ -64,7 +64,12 @@ public abstract class BinaryMemcacheEncoder<M extends BinaryMemcacheMessage<H>,
|
||||
return;
|
||||
}
|
||||
|
||||
buf.writeBytes(Unpooled.copiedBuffer(key, CharsetUtil.UTF_8));
|
||||
ByteBuf keyBuf = Unpooled.copiedBuffer(key, CharsetUtil.UTF_8);
|
||||
try {
|
||||
buf.writeBytes(keyBuf);
|
||||
} finally {
|
||||
keyBuf.release();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user