#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)
|
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);
|
return _pool.acquire(capacity, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,11 @@ import org.eclipse.jetty.util.BufferUtil;
|
||||||
*/
|
*/
|
||||||
public interface RetainableByteBuffer extends Retainable
|
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
|
* <p>Returns a non-retainable {@code RetainableByteBuffer} that wraps
|
||||||
* the given {@code ByteBuffer}.</p>
|
* the given {@code ByteBuffer}.</p>
|
||||||
|
|
Loading…
Reference in New Issue