Skip to content

Commit

Permalink
Issue #6470 - prevent EOF being released back into pool
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Jun 30, 2021
1 parent f045b5a commit 039a539
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public void close()

for (ByteBuffer buffer : buffers)
{
bufferPool.release(buffer);
if (buffer != null && buffer != EOF)
bufferPool.release(buffer);
}

activeBuffer = null;
Expand Down Expand Up @@ -259,7 +260,8 @@ public int read(byte[] b, int off, int len) throws IOException
synchronized (this)
{
// Release buffer back to pool.
bufferPool.release(activeBuffer);
if (activeBuffer != null && activeBuffer != EOF)
bufferPool.release(activeBuffer);
activeBuffer = null;

switch (state)
Expand Down

0 comments on commit 039a539

Please sign in to comment.