From 7d0687aa4aad6460672f765ae5a273101226313c Mon Sep 17 00:00:00 2001 From: Myles Date: Sat, 19 Mar 2016 23:47:03 +0000 Subject: [PATCH] Fix chance of another leak happening... --- .../java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java index c28dc4e57..652a2a337 100644 --- a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java +++ b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java @@ -33,10 +33,12 @@ public class ViaDecodeHandler extends ByteToMessageDecoder { ByteBuf newPacket = ctx.alloc().buffer(); try { incomingTransformer.transform(id, bytebuf, newPacket); - bytebuf.clear(); bytebuf = newPacket; } catch (Exception e) { + // Clear Buffer bytebuf.clear(); + // Release Packet, be free! + newPacket.release(); throw e; } }