From 99ac770abbe3a95887c4b10c82f3985aa878eeef Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 1 Jun 2014 17:39:11 +0300 Subject: Close streams immediately when we finish using them --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'OpenSim/Server/Handlers/Map') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index a896fdb..649a27e 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -188,7 +188,7 @@ namespace OpenSim.Server.Handlers.MapImage rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult(string msg) @@ -215,18 +215,7 @@ namespace OpenSim.Server.Handlers.MapImage rootElement.AppendChild(message); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) -- cgit v1.1