From d43442a0e08a6117116b87974003bd1051a70782 Mon Sep 17 00:00:00 2001 From: haohao Date: Thu, 29 Jan 2015 16:26:13 +0800 Subject: [PATCH] [#3368] Ensure ByteBuf is not release two times Motivation: As the ByteBuf is not set to null after release it we may try to release it again in handleReadException() Modifications: - set ByteBuf to null to avoid another byteBuf.release() to be called in handleReadException() Result: No IllegalReferenceCountException anymore --- .../main/java/io/netty/channel/nio/AbstractNioByteChannel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java b/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java index ccf8f54a82..b4e5b19049 100644 --- a/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java +++ b/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java @@ -116,6 +116,7 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel { if (localReadAmount <= 0) { // not was read release the buffer byteBuf.release(); + byteBuf = null; close = localReadAmount < 0; break; }