From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 3 Nov 2016 21:44:39 +1000 Subject: Initial update to OpenSim 0.8.2.1 source code. --- OpenSim/Capabilities/LLSD.cs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'OpenSim/Capabilities/LLSD.cs') diff --git a/OpenSim/Capabilities/LLSD.cs b/OpenSim/Capabilities/LLSD.cs index eec9e61..c59cede 100644 --- a/OpenSim/Capabilities/LLSD.cs +++ b/OpenSim/Capabilities/LLSD.cs @@ -68,7 +68,10 @@ namespace OpenSim.Framework.Capabilities /// public static object LLSDDeserialize(byte[] b) { - return LLSDDeserialize(new MemoryStream(b, false)); + using (MemoryStream ms = new MemoryStream(b, false)) + { + return LLSDDeserialize(ms); + } } /// @@ -78,21 +81,23 @@ namespace OpenSim.Framework.Capabilities /// public static object LLSDDeserialize(Stream st) { - XmlTextReader reader = new XmlTextReader(st); - reader.Read(); - SkipWS(reader); + using (XmlTextReader reader = new XmlTextReader(st)) + { + reader.Read(); + SkipWS(reader); - if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd") - throw new LLSDParseException("Expected "); + if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd") + throw new LLSDParseException("Expected "); - reader.Read(); - object ret = LLSDParseOne(reader); - SkipWS(reader); + reader.Read(); + object ret = LLSDParseOne(reader); + SkipWS(reader); - if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd") - throw new LLSDParseException("Expected "); + if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd") + throw new LLSDParseException("Expected "); - return ret; + return ret; + } } /// -- cgit v1.1