Skip to content

Commit 039a539

Browse files
Issue #6470 - prevent EOF being released back into pool
Signed-off-by: Lachlan Roberts <[email protected]>
1 parent f045b5a commit 039a539

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ public void close()
163163

164164
for (ByteBuffer buffer : buffers)
165165
{
166-
bufferPool.release(buffer);
166+
if (buffer != null && buffer != EOF)
167+
bufferPool.release(buffer);
167168
}
168169

169170
activeBuffer = null;
@@ -259,7 +260,8 @@ public int read(byte[] b, int off, int len) throws IOException
259260
synchronized (this)
260261
{
261262
// Release buffer back to pool.
262-
bufferPool.release(activeBuffer);
263+
if (activeBuffer != null && activeBuffer != EOF)
264+
bufferPool.release(activeBuffer);
263265
activeBuffer = null;
264266

265267
switch (state)

0 commit comments

Comments
 (0)