diff options
author | Oren Hurvitz | 2014-06-01 17:39:11 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-07-21 08:30:03 +0100 |
commit | 99ac770abbe3a95887c4b10c82f3985aa878eeef (patch) | |
tree | 8c946dab083dd50a352f3861415eca43185d8d95 /OpenSim/Capabilities | |
parent | Set "[Terrain]SendTerrainUpdatesByViewDistance=true" by default. (diff) | |
download | opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.zip opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.gz opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.bz2 opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.xz |
Close streams immediately when we finish using them
Diffstat (limited to 'OpenSim/Capabilities')
-rw-r--r-- | OpenSim/Capabilities/LLSD.cs | 29 |
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> |