diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/PlayerHeadTexture.java b/src/main/java/meteordevelopment/meteorclient/utils/render/PlayerHeadTexture.java index 94c0b47524..34a451889d 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/PlayerHeadTexture.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/PlayerHeadTexture.java @@ -8,10 +8,12 @@ import org.lwjgl.BufferUtils; import org.lwjgl.stb.STBImage; import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.IOException; +import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -65,8 +67,8 @@ public PlayerHeadTexture(String url) { } public PlayerHeadTexture() { - try { - ByteBuffer data = TextureUtil.readResource(mc.getResourceManager().getResource(new MeteorIdentifier("textures/steve.png")).get().getInputStream()); + try (InputStream inputStream = mc.getResourceManager().getResource(new MeteorIdentifier("textures/steve.png")).get().getInputStream()) { + ByteBuffer data = TextureUtil.readResource(inputStream); data.rewind(); try (MemoryStack stack = MemoryStack.stackPush()) { @@ -78,6 +80,7 @@ public PlayerHeadTexture() { upload(image); STBImage.stbi_image_free(image); } + MemoryUtil.memFree(data); } catch (IOException e) { e.printStackTrace();