Fix resource-leak which was reported as a result of commit 69070c37ba

This commit is contained in:
Norman Maurer 2016-04-12 16:27:02 +02:00
parent 379ad2c02e
commit 718bf2fa45

View File

@ -15,6 +15,7 @@
*/
package io.netty.handler.codec.http;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.codec.TooLongFrameException;
@ -576,7 +577,16 @@ public class HttpResponseDecoderTest {
assertThat(ch.finish(), is(true));
assertEquals(ch.readInbound(), Unpooled.wrappedBuffer(otherData));
ByteBuf expected = Unpooled.wrappedBuffer(otherData);
ByteBuf buffer = ch.readInbound();
try {
assertEquals(expected, buffer);
} finally {
expected.release();
if (buffer != null) {
buffer.release();
}
}
}
@Test