Always close script linemap file after reading and always dispose of other streams in the script engine even if exceptions are thrown.

This commit is contained in:
Justin Clark-Casey (justincc)
2014-12-03 18:58:55 +00:00
parent caa7b1e6a1
commit 72d1d96c5c
2 changed files with 29 additions and 29 deletions

View File

@@ -1065,10 +1065,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
try
{
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"));
Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml);
fs.Write(buf, 0, buf.Length);
fs.Close();
using (FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")))
{
Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml);
fs.Write(buf, 0, buf.Length);
}
}
catch(Exception)
{