sandynz commented on code in PR #19410:
URL: https://github.com/apache/shardingsphere/pull/19410#discussion_r926280616
##########
shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java:
##########
@@ -39,7 +40,10 @@ public final class MySQLJsonBinlogProtocolValue implements
MySQLBinlogProtocolVa
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final
MySQLPacketPayload payload) {
- return
MySQLJsonValueDecoder.decode(payload.getByteBuf().readBytes(readLengthFromMeta(columnDef.getColumnMeta(),
payload)));
+ ByteBuf newByteBuf =
payload.getByteBuf().readBytes(readLengthFromMeta(columnDef.getColumnMeta(),
payload));
+ Serializable result = MySQLJsonValueDecoder.decode(newByteBuf);
+ newByteBuf.release();
+ return result;
Review Comment:
It's better to do release() in finally block if we keep allocating a new
ByteBuf, since MySQLJsonValueDecoder.decode might throw exception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]