mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-16 18:31:53 +01:00
Cleanup allocated favicon ByteBuf (fixes #1191)
Cleanups a bytebuffer which was allocated during the encoding of the favicon to be sent to the client.
This commit is contained in:
parent
9d16e77b90
commit
702bbe6f8a
1 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Tue, 3 Jul 2018 19:14:38 +0100
|
||||
Subject: [PATCH] Cleanup allocated favicon ByteBuf
|
||||
|
||||
Cleanups a bytebuffer which was allocated during the encoding of the
|
||||
favicon to be sent to the client.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f82e22b23..0399a48e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
|
||||
|
||||
if (file.isFile()) {
|
||||
ByteBuf bytebuf = Unpooled.buffer();
|
||||
+ ByteBuf bytebuf1 = null; // Paper - cleanup favicon bytebuf
|
||||
|
||||
try {
|
||||
BufferedImage bufferedimage = ImageIO.read(file);
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
|
||||
Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
|
||||
Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
|
||||
ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
|
||||
- ByteBuf bytebuf1 = Base64.encode(bytebuf);
|
||||
+ /*ByteBuf */ bytebuf1 = Base64.encode(bytebuf); // Paper - cleanup favicon bytebuf
|
||||
|
||||
serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8));
|
||||
} catch (Exception exception) {
|
||||
MinecraftServer.LOGGER.error("Couldn\'t load server icon", exception);
|
||||
} finally {
|
||||
bytebuf.release();
|
||||
+ // Paper start - cleanup favicon bytebuf
|
||||
+ if (bytebuf1 != null) {
|
||||
+ bytebuf1.release();
|
||||
+ }
|
||||
+ // Paper end - cleanup favicon bytebuf
|
||||
}
|
||||
}
|
||||
|
||||
--
|
Loading…
Add table
Reference in a new issue