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

@@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
reqStream.Close();
}
HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse();
Encoding encoding = Util.UTF8;
StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding);
fwdresponsestr = fwdresponsestream.ReadToEnd();
fwdresponsecontenttype = fwdrsp.ContentType;
fwdresponsecode = (int)fwdrsp.StatusCode;
fwdresponsestream.Close();
using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse())
{
Encoding encoding = Util.UTF8;
using (Stream s = fwdrsp.GetResponseStream())
{
using (StreamReader fwdresponsestream = new StreamReader(s))
{
fwdresponsestr = fwdresponsestream.ReadToEnd();
fwdresponsecontenttype = fwdrsp.ContentType;
fwdresponsecode = (int)fwdrsp.StatusCode;
}
}
}
response["content_type"] = fwdresponsecontenttype;
response["str_response_string"] = fwdresponsestr;