From 2ab82664e38ef94847bb42d3078a85494e26b59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 9 Jul 2016 20:07:36 +0200 Subject: [PATCH] Dispose the intermediate Stream after copying it to pkgStream. --- OpenRA.Game/FileSystem/ZipFile.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/FileSystem/ZipFile.cs b/OpenRA.Game/FileSystem/ZipFile.cs index 4d619dc538..07d0e35fc7 100644 --- a/OpenRA.Game/FileSystem/ZipFile.cs +++ b/OpenRA.Game/FileSystem/ZipFile.cs @@ -57,7 +57,8 @@ namespace OpenRA.FileSystem // SharpZipLib breaks when asked to update archives loaded from outside streams or files // We can work around this by creating a clean in-memory-only file, cutting all outside references pkgStream = new MemoryStream(); - p.GetStream(name).CopyTo(pkgStream); + using (var sourceStream = p.GetStream(name)) + sourceStream.CopyTo(pkgStream); pkgStream.Position = 0; pkg = new SZipFile(pkgStream);