mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-19 00:35:55 +01:00
2554ec2219
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by 2LStudios and as with ANY update, please do your own testing Waterfall Changes:59dbd08
Updated Upstream (BungeeCord) (#747)9719e25
Temp disable protocol limits for 1.199b0080a
Fix crash on startup (#743)958ae29
Updated Upstream (BungeeCord) (#741)29f1cfb
Improve login state transitiona44c78a
Various library bumps
69 lines
2.6 KiB
Diff
69 lines
2.6 KiB
Diff
From 2553ca852c00716e467c00887160a0bdeaaaa36b Mon Sep 17 00:00:00 2001
|
|
From: linsaftw <linsaftw@users.noreply.github.com>
|
|
Date: Sat, 20 Mar 2021 12:36:25 -0300
|
|
Subject: [PATCH] Fix ByteBuf memory leaks
|
|
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
|
index 73fd60e0..9ec16808 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
|
@@ -152,11 +152,15 @@ public abstract class EntityMap
|
|
if ( readId == oldId || readId == newId )
|
|
{
|
|
ByteBuf data = packet.copy();
|
|
- packet.readerIndex( offset );
|
|
- packet.writerIndex( offset );
|
|
- DefinedPacket.writeVarInt( readId == oldId ? newId : oldId, packet );
|
|
- packet.writeBytes( data );
|
|
- data.release();
|
|
+
|
|
+ try {
|
|
+ packet.readerIndex( offset );
|
|
+ packet.writerIndex( offset );
|
|
+ DefinedPacket.writeVarInt( readId == oldId ? newId : oldId, packet );
|
|
+ packet.writeBytes( data );
|
|
+ } finally {
|
|
+ data.release();
|
|
+ }
|
|
}
|
|
}
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java b/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java
|
|
index cefa0206..8d4439ab 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java
|
|
@@ -38,16 +38,22 @@ public class ForgeUtils
|
|
{
|
|
Map<String, String> modTags = new HashMap<>();
|
|
ByteBuf payload = Unpooled.wrappedBuffer( pluginMessage.getData() );
|
|
- byte discriminator = payload.readByte();
|
|
- if ( discriminator == 2 ) // ModList
|
|
- {
|
|
- ByteBuf buffer = payload.slice();
|
|
- int modCount = DefinedPacket.readVarInt( buffer, 2 );
|
|
- for ( int i = 0; i < modCount; i++ )
|
|
+
|
|
+ try {
|
|
+ byte discriminator = payload.readByte();
|
|
+ if ( discriminator == 2 ) // ModList
|
|
{
|
|
- modTags.put( DefinedPacket.readString( buffer ), DefinedPacket.readString( buffer ) );
|
|
+ ByteBuf buffer = payload.slice();
|
|
+ int modCount = DefinedPacket.readVarInt( buffer, 2 );
|
|
+ for ( int i = 0; i < modCount; i++ )
|
|
+ {
|
|
+ modTags.put( DefinedPacket.readString( buffer ), DefinedPacket.readString( buffer ) );
|
|
+ }
|
|
}
|
|
+ } finally {
|
|
+ payload.release();
|
|
}
|
|
+
|
|
return modTags;
|
|
}
|
|
|
|
--
|
|
2.36.1.windows.1
|
|
|