Close streams immediately when we finish using them

This commit is contained in:
Oren Hurvitz
2014-06-01 17:39:11 +03:00
parent b81187db5a
commit 99ac770abb
34 changed files with 426 additions and 485 deletions

View File

@@ -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)