Fix memory leak in DefaultChannelHandlerContext
.. where freeInbound() and freeOutbound() are not called for all contexts - Fixes #1298
This commit is contained in:
parent
e80fb65c36
commit
d85757a008
@ -1467,16 +1467,15 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
||||
|
||||
private void invokeFreeInboundBuffer0() {
|
||||
ChannelHandler handler = handler();
|
||||
if (handler instanceof ChannelInboundHandler) {
|
||||
ChannelInboundHandler h = (ChannelInboundHandler) handler;
|
||||
try {
|
||||
h.freeInboundBuffer(this);
|
||||
if (handler instanceof ChannelInboundHandler) {
|
||||
((ChannelInboundHandler) handler).freeInboundBuffer(this);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
notifyHandlerException(t);
|
||||
} finally {
|
||||
freeInbound();
|
||||
}
|
||||
}
|
||||
|
||||
if (next != null) {
|
||||
DefaultChannelHandlerContext nextCtx = findContextInbound();
|
||||
@ -1519,16 +1518,15 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
||||
|
||||
private void invokeFreeOutboundBuffer0() {
|
||||
ChannelHandler handler = handler();
|
||||
if (handler instanceof ChannelOutboundHandler) {
|
||||
ChannelOutboundHandler h = (ChannelOutboundHandler) handler;
|
||||
try {
|
||||
h.freeOutboundBuffer(this);
|
||||
if (handler instanceof ChannelOutboundHandler) {
|
||||
((ChannelOutboundHandler) handler).freeOutboundBuffer(this);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
notifyHandlerException(t);
|
||||
} finally {
|
||||
freeOutbound();
|
||||
}
|
||||
}
|
||||
|
||||
if (prev != null) {
|
||||
findContextOutbound().invokeFreeOutboundBuffer();
|
||||
|
Loading…
Reference in New Issue
Block a user