#10226 fix GZIPContentDecoder buffer leak of zero-capacity buffers
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
7083fa3927
commit
2fcccef0c4
|
@ -422,6 +422,9 @@ public class GZIPContentDecoder implements Destroyable
|
|||
*/
|
||||
public RetainableByteBuffer acquire(int capacity)
|
||||
{
|
||||
// Zero-capacity buffers aren't released, they MUST NOT come from the pool.
|
||||
if (capacity == 0)
|
||||
return RetainableByteBuffer.EMPTY;
|
||||
return _pool.acquire(capacity, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ import org.eclipse.jetty.util.BufferUtil;
|
|||
*/
|
||||
public interface RetainableByteBuffer extends Retainable
|
||||
{
|
||||
/**
|
||||
* A Zero-capacity, non-retainable {@code RetainableByteBuffer}.
|
||||
*/
|
||||
public static RetainableByteBuffer EMPTY = wrap(BufferUtil.EMPTY_BUFFER);
|
||||
|
||||
/**
|
||||
* <p>Returns a non-retainable {@code RetainableByteBuffer} that wraps
|
||||
* the given {@code ByteBuffer}.</p>
|
||||
|
|
Loading…
Reference in New Issue