aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities
diff options
context:
space:
mode:
authorOren Hurvitz2014-06-01 17:39:11 +0300
committerJustin Clark-Casey2014-08-02 00:55:57 +0100
commite41e52e09727842d990a31e2a5f7f3e9c88fe8b3 (patch)
tree5779c9f42cd913f63e2d237b5a407214933585db /OpenSim/Capabilities
parentAdd code to GridService to check for overlapping of varregions (diff)
downloadopensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.zip
opensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.tar.gz
opensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.tar.bz2
opensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.tar.xz
Close streams immediately when we finish using them
Diffstat (limited to 'OpenSim/Capabilities')
-rw-r--r--OpenSim/Capabilities/LLSD.cs29
1 files changed, 17 insertions, 12 deletions
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
68 /// <returns></returns> 68 /// <returns></returns>
69 public static object LLSDDeserialize(byte[] b) 69 public static object LLSDDeserialize(byte[] b)
70 { 70 {
71 return LLSDDeserialize(new MemoryStream(b, false)); 71 using (MemoryStream ms = new MemoryStream(b, false))
72 {
73 return LLSDDeserialize(ms);
74 }
72 } 75 }
73 76
74 /// <summary> 77 /// <summary>
@@ -78,21 +81,23 @@ namespace OpenSim.Framework.Capabilities
78 /// <returns></returns> 81 /// <returns></returns>
79 public static object LLSDDeserialize(Stream st) 82 public static object LLSDDeserialize(Stream st)
80 { 83 {
81 XmlTextReader reader = new XmlTextReader(st); 84 using (XmlTextReader reader = new XmlTextReader(st))
82 reader.Read(); 85 {
83 SkipWS(reader); 86 reader.Read();
87 SkipWS(reader);
84 88
85 if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd") 89 if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
86 throw new LLSDParseException("Expected <llsd>"); 90 throw new LLSDParseException("Expected <llsd>");
87 91
88 reader.Read(); 92 reader.Read();
89 object ret = LLSDParseOne(reader); 93 object ret = LLSDParseOne(reader);
90 SkipWS(reader); 94 SkipWS(reader);
91 95
92 if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd") 96 if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
93 throw new LLSDParseException("Expected </llsd>"); 97 throw new LLSDParseException("Expected </llsd>");
94 98
95 return ret; 99 return ret;
100 }
96 } 101 }
97 102
98 /// <summary> 103 /// <summary>