From 2619edff5a2e3bad4135cf57dee313a8dbae6786 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 5 Mar 2015 16:22:07 +1100 Subject: [PATCH] 461452 Double release of buffer by HttpReceiverOverHTTP Clear buffer on exception to avoid release guard --- .../org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java index 21ae185cab7..d39a0f220d7 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java @@ -80,6 +80,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res { if (buffer==null) throw new IllegalStateException(); + if (BufferUtil.hasContent(buffer)) + throw new IllegalStateException(); HttpClient client = getHttpDestination().getHttpClient(); ByteBufferPool bufferPool = client.getByteBufferPool(); bufferPool.release(buffer); @@ -133,6 +135,7 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res { if (LOG.isDebugEnabled()) LOG.debug(x); + BufferUtil.clear(buffer); releaseBuffer(); failAndClose(x); }