Avoid memory leak when encoding the key

This commit is contained in:
Michael Nitschinger 2013-11-22 14:57:03 +01:00 committed by Trustin Lee
parent eb308cfff6
commit c78544cfaa

View File

@ -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();
}
}
/**