From a86e215718102e302f09ebeafedcaa5b0f00c3ed Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 7 Nov 2013 07:12:19 +0100 Subject: [PATCH] Fix regression which lead to leak buffers when nothing could be read from the Channel. This was introduced as part of #1812, but fortunatualy was not part of any release. --- .../main/java/io/netty/channel/nio/AbstractNioByteChannel.java | 2 ++ 1 file changed, 2 insertions(+) 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 05f0a06f6b..4651adc457 100644 --- a/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java +++ b/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java @@ -115,6 +115,8 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel { byteBuf = allocHandle.allocate(allocator); int localReadAmount = doReadBytes(byteBuf); if (localReadAmount <= 0) { + // not was read release the buffer + byteBuf.release(); close = localReadAmount < 0; break; }