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() {
|
private void invokeFreeInboundBuffer0() {
|
||||||
ChannelHandler handler = handler();
|
ChannelHandler handler = handler();
|
||||||
if (handler instanceof ChannelInboundHandler) {
|
|
||||||
ChannelInboundHandler h = (ChannelInboundHandler) handler;
|
|
||||||
try {
|
try {
|
||||||
h.freeInboundBuffer(this);
|
if (handler instanceof ChannelInboundHandler) {
|
||||||
|
((ChannelInboundHandler) handler).freeInboundBuffer(this);
|
||||||
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
notifyHandlerException(t);
|
notifyHandlerException(t);
|
||||||
} finally {
|
} finally {
|
||||||
freeInbound();
|
freeInbound();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (next != null) {
|
if (next != null) {
|
||||||
DefaultChannelHandlerContext nextCtx = findContextInbound();
|
DefaultChannelHandlerContext nextCtx = findContextInbound();
|
||||||
@ -1519,16 +1518,15 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
|
|
||||||
private void invokeFreeOutboundBuffer0() {
|
private void invokeFreeOutboundBuffer0() {
|
||||||
ChannelHandler handler = handler();
|
ChannelHandler handler = handler();
|
||||||
if (handler instanceof ChannelOutboundHandler) {
|
|
||||||
ChannelOutboundHandler h = (ChannelOutboundHandler) handler;
|
|
||||||
try {
|
try {
|
||||||
h.freeOutboundBuffer(this);
|
if (handler instanceof ChannelOutboundHandler) {
|
||||||
|
((ChannelOutboundHandler) handler).freeOutboundBuffer(this);
|
||||||
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
notifyHandlerException(t);
|
notifyHandlerException(t);
|
||||||
} finally {
|
} finally {
|
||||||
freeOutbound();
|
freeOutbound();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (prev != null) {
|
if (prev != null) {
|
||||||
findContextOutbound().invokeFreeOutboundBuffer();
|
findContextOutbound().invokeFreeOutboundBuffer();
|
||||||
|
Loading…
Reference in New Issue
Block a user