3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Patch the other mem leak fix across

Dieser Commit ist enthalten in:
Myles 2016-03-19 23:49:26 +00:00
Commit b226e94981

Datei anzeigen

@ -31,18 +31,20 @@ public class ViaDecodeHandler extends ByteToMessageDecoder {
if (info.isActive()) { if (info.isActive()) {
int id = Type.VAR_INT.read(bytebuf); int id = Type.VAR_INT.read(bytebuf);
// Transform // Transform
ByteBuf newPacket = ctx.alloc().buffer();
try { try {
PacketWrapper wrapper = new PacketWrapper(id, bytebuf, info); PacketWrapper wrapper = new PacketWrapper(id, bytebuf, info);
ProtocolInfo protInfo = info.get(ProtocolInfo.class); ProtocolInfo protInfo = info.get(ProtocolInfo.class);
protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper); protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper);
ByteBuf newPacket = ctx.alloc().buffer();
wrapper.writeToBuffer(newPacket); wrapper.writeToBuffer(newPacket);
bytebuf.clear(); bytebuf.clear();
bytebuf = newPacket; bytebuf = newPacket;
} catch (Exception e) { } catch (Exception e) {
// Clear Buffer
bytebuf.clear(); bytebuf.clear();
// Release Packet, be free!
newPacket.release();
throw e; throw e;
} }
} }