[#539] Potential direct memory leak in HttpContentEn/Decoder

This commit is contained in:
Trustin Lee 2012-08-20 12:18:39 +09:00
parent 7f3f792017
commit 10f26f3205
2 changed files with 8 additions and 2 deletions

View File

@ -63,7 +63,10 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<Object,
} else if (msg instanceof HttpMessage) { } else if (msg instanceof HttpMessage) {
HttpMessage m = (HttpMessage) msg; HttpMessage m = (HttpMessage) msg;
decoder = null; if (decoder != null) {
// Clean-up the previous decoder if not cleaned up correctly.
finishDecode(Unpooled.buffer());
}
// Determine the content encoding. // Determine the content encoding.
String contentEncoding = m.getHeader(HttpHeaders.Names.CONTENT_ENCODING); String contentEncoding = m.getHeader(HttpHeaders.Names.CONTENT_ENCODING);

View File

@ -88,7 +88,10 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
} else if (msg instanceof HttpMessage) { } else if (msg instanceof HttpMessage) {
HttpMessage m = (HttpMessage) msg; HttpMessage m = (HttpMessage) msg;
encoder = null; if (encoder != null) {
// Clean-up the previous encoder if not cleaned up correctly.
finishEncode(Unpooled.buffer());
}
// Determine the content encoding. // Determine the content encoding.
String acceptEncoding = acceptEncodingQueue.poll(); String acceptEncoding = acceptEncodingQueue.poll();