From 0bed7317e7674b57e1d5e19ce97d2c11cdc552c8 Mon Sep 17 00:00:00 2001 From: Crsky Date: Thu, 2 Apr 2026 05:49:46 +0800 Subject: [PATCH] fix: Stream dispose --- ArcFormats/Nexas/ArcPAC.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ArcFormats/Nexas/ArcPAC.cs b/ArcFormats/Nexas/ArcPAC.cs index 31bb3a52..1e9fd784 100644 --- a/ArcFormats/Nexas/ArcPAC.cs +++ b/ArcFormats/Nexas/ArcPAC.cs @@ -268,11 +268,14 @@ namespace GameRes.Formats.NeXAS return input; if (Compression.NeedDecryptionOnly == pac.PackType) { - var data = new byte[entry.Size]; - input.Read (data, 0, data.Length); - for (int i = 0; i < Math.Min (3, data.Length); i++) - data[i] = (byte)~data[i]; - return new BinMemoryStream (data, entry.Name); + using (input) + { + var data = new byte[entry.Size]; + input.Read (data, 0, data.Length); + for (int i = 0; i < Math.Min (3, data.Length); i++) + data[i] = (byte)~data[i]; + return new BinMemoryStream (data, entry.Name); + } } if (null == pent || !pent.IsPacked) return input; @@ -296,8 +299,11 @@ namespace GameRes.Formats.NeXAS case Compression.Zstd: case Compression.ZstdOrNone: { - var unpacked = ZstdDecompress (input, pent.UnpackedSize); - return new BinMemoryStream (unpacked, entry.Name); + using (input) + { + var unpacked = ZstdDecompress (input, pent.UnpackedSize); + return new BinMemoryStream (unpacked, entry.Name); + } } default: return input;