aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base/ServerUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs20
1 files changed, 11 insertions, 9 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index c92e23c..8f1d56b 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -196,17 +196,19 @@ namespace OpenSim.Server.Base
196 196
197 public static byte[] SerializeResult(XmlSerializer xs, object data) 197 public static byte[] SerializeResult(XmlSerializer xs, object data)
198 { 198 {
199 MemoryStream ms = new MemoryStream(); 199 using (MemoryStream ms = new MemoryStream())
200 XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8); 200 using (XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8))
201 xw.Formatting = Formatting.Indented; 201 {
202 xs.Serialize(xw, data); 202 xw.Formatting = Formatting.Indented;
203 xw.Flush(); 203 xs.Serialize(xw, data);
204 xw.Flush();
204 205
205 ms.Seek(0, SeekOrigin.Begin); 206 ms.Seek(0, SeekOrigin.Begin);
206 byte[] ret = ms.GetBuffer(); 207 byte[] ret = ms.GetBuffer();
207 Array.Resize(ref ret, (int)ms.Length); 208 Array.Resize(ref ret, (int)ms.Length);
208 209
209 return ret; 210 return ret;
211 }
210 } 212 }
211 213
212 /// <summary> 214 /// <summary>