Fix memory leaks by closing streams

This commit is contained in:
Kam committed 2025-07-23 05:43:50 -04:00
1 parent 39e51bc8c2
commit 540508a2be
18 files changed
+96 -60

No files matched your search

@@ -213,8 +213,8 @@ public class NBTJsonUtil {
}
public static NBTTagCompound loadNBTData(File file) {
try {
return CompressedStreamTools.readCompressed(new FileInputStream(file));
try (FileInputStream fis = new FileInputStream(file)) {
return CompressedStreamTools.readCompressed(fis);
} catch (Exception e) {
LogWriter.error("Error loading: " + file.getName(), e);
}