You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2019/01/29 05:55:15 UTC

[mina-sshd] 01/05: [SSHD-833] Fixed Netty: ByteBuf LEAK message

This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit a150dec938cad556862272e4d13ce07fdd33f50f
Author: linejs <zh...@163.com>
AuthorDate: Sun Jan 6 13:35:27 2019 +0200

    [SSHD-833] Fixed Netty: ByteBuf LEAK message
---
 sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java
index 56cb4ff..64db5d8 100644
--- a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java
+++ b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java
@@ -186,7 +186,11 @@ public class NettyIoSession extends AbstractCloseable implements IoSession {
 
     protected void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
         ByteBuf buf = (ByteBuf) msg;
-        handler.messageReceived(NettyIoSession.this, NettySupport.asReadable(buf));
+        try {
+            handler.messageReceived(NettyIoSession.this, NettySupport.asReadable(buf));
+        } finally {
+            buf.release();
+        }
     }
 
     protected void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {