From b1e8efb00b50abd9a2eb4dfd72b29c3660a09cd4 Mon Sep 17 00:00:00 2001 From: creeper123123321 Date: Sat, 28 Jul 2018 17:53:17 -0300 Subject: [PATCH] Fix memory leak --- .../ViaVersion/bungee/handlers/BungeeEncodeHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeEncodeHandler.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeEncodeHandler.java index 3d88529c2..fc39eebdd 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeEncodeHandler.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeEncodeHandler.java @@ -69,9 +69,13 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder { } if (needsCompress) { + ByteBuf old = bytebuf; bytebuf = BungeePipelineUtil.compress(ctx, bytebuf); + old.release(); + out.add(bytebuf); + } else { + out.add(bytebuf.retain()); } - out.add(bytebuf.retain()); } @Override