Make sure we dispose of WebResponse, StreamReader and Stream in various places where we were not already.

This commit is contained in:
Justin Clark-Casey (justincc)
2013-02-27 00:21:02 +00:00
parent 2bfbfc5725
commit 80c19b7cac
14 changed files with 243 additions and 210 deletions

View File

@@ -65,23 +65,27 @@ namespace OpenSim.Framework.Configuration.HTTP
byte[] buf = new byte[8192];
HttpWebRequest request =
(HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream resStream = response.GetResponseStream();
string tempString = null;
int count = 0;
do
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
using (Stream resStream = response.GetResponseStream())
{
tempString = Util.UTF8.GetString(buf, 0, count);
sb.Append(tempString);
string tempString = null;
int count = 0;
do
{
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
{
tempString = Util.UTF8.GetString(buf, 0, count);
sb.Append(tempString);
}
}
while (count > 0);
LoadDataFromString(sb.ToString());
}
} while (count > 0);
LoadDataFromString(sb.ToString());
}
}
catch (WebException)
{