461452 Double release of buffer by HttpReceiverOverHTTP

Clear buffer on exception to avoid release guard
This commit is contained in:
Greg Wilkins 2015-03-05 16:22:07 +11:00
parent 042de2ec9f
commit 2619edff5a
1 changed files with 3 additions and 0 deletions

View File

@ -80,6 +80,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
{ {
if (buffer==null) if (buffer==null)
throw new IllegalStateException(); throw new IllegalStateException();
if (BufferUtil.hasContent(buffer))
throw new IllegalStateException();
HttpClient client = getHttpDestination().getHttpClient(); HttpClient client = getHttpDestination().getHttpClient();
ByteBufferPool bufferPool = client.getByteBufferPool(); ByteBufferPool bufferPool = client.getByteBufferPool();
bufferPool.release(buffer); bufferPool.release(buffer);
@ -133,6 +135,7 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
{ {
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug(x); LOG.debug(x);
BufferUtil.clear(buffer);
releaseBuffer(); releaseBuffer();
failAndClose(x); failAndClose(x);
} }