From eb93855d84414be6c9e927c0da3be56ae6831573 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 May 2017 17:47:43 +0100 Subject: dispose some MemoryStreams --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 14 ++++++++------ OpenSim/Data/PGSQL/PGSQLXAssetData.cs | 10 ++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 2ef7f8f..23f6837 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -163,13 +163,15 @@ namespace OpenSim.Data.MySQL if (m_enableCompression) { - using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) + using(GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), + CompressionMode.Decompress)) { - MemoryStream outputStream = new MemoryStream(); - WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); -// int compressedLength = asset.Data.Length; - asset.Data = outputStream.ToArray(); - + using(MemoryStream outputStream = new MemoryStream()) + { + WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); +// int compressedLength = asset.Data.Length; + asset.Data = outputStream.ToArray(); + } // m_log.DebugFormat( // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", // asset.ID, asset.Name, asset.Data.Length, compressedLength); diff --git a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs index 6e88489..000a446 100644 --- a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs @@ -173,13 +173,15 @@ namespace OpenSim.Data.PGSQL if (m_enableCompression) { - using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) + using (GZipStream decompressionStream = new GZipStream( new MemoryStream(asset.Data), + CompressionMode.Decompress)) { - MemoryStream outputStream = new MemoryStream(); - WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); + using(MemoryStream outputStream = new MemoryStream()) + { + WebUtil.CopyStream(decompressionStream,outputStream,int.MaxValue); // int compressedLength = asset.Data.Length; asset.Data = outputStream.ToArray(); - + } // m_log.DebugFormat( // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", // asset.ID, asset.Name, asset.Data.Length, compressedLength); -- cgit v1.1