From ae191cd3042fec6b753b41b19907d236690a70cf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 May 2017 15:57:47 +0100 Subject: dispose some MemoryStreams --- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index f292b95..ffd8ef6 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -215,13 +215,16 @@ namespace OpenSim.Server.Handlers.MapImage private byte[] DocToBytes(XmlDocument doc) { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - + using(MemoryStream ms = new MemoryStream()) + { + using(XmlTextWriter xw = new XmlTextWriter(ms,null)) + { + xw.Formatting = Formatting.Indented; + doc.WriteTo(xw); + xw.Flush(); + } return ms.ToArray(); + } } private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) -- cgit v1.1